File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -2045,9 +2045,9 @@ def replace_defined(line: str):
20452045 out_line = ""
20462046 for match in FRegex .DEFINED .finditer (line ):
20472047 if match .group (1 ) in defs :
2048- out_line += line [i0 : match .start (0 )] + "($@)"
2048+ out_line += line [i0 : match .start (0 )] + "(@ $@)"
20492049 else :
2050- out_line += line [i0 : match .start (0 )] + "($%)"
2050+ out_line += line [i0 : match .start (0 )] + "(% $%)"
20512051 i0 = match .end (0 )
20522052 if i0 < len (line ):
20532053 out_line += line [i0 :]
@@ -2064,8 +2064,8 @@ def replace_vars(line: str):
20642064 i0 = match .end (0 )
20652065 if i0 < len (line ):
20662066 out_line += line [i0 :]
2067- out_line = out_line .replace ("$@" , "True" )
2068- out_line = out_line .replace ("$%" , "False" )
2067+ out_line = out_line .replace ("@ $@" , "True" )
2068+ out_line = out_line .replace ("% $%" , "False" )
20692069 return out_line
20702070
20712071 if defs is None :
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ class FortranRegularExpressions:
9898 r"[ ]*,[ ]*(PUBLIC|PRIVATE|ABSTRACT|EXTENDS\(\w*\))" , I
9999 )
100100 VIS : Pattern = compile (r"[ ]*\b(PUBLIC|PRIVATE)\b" , I )
101- WORD : Pattern = compile (r"[a-z_]\w *" , I )
101+ WORD : Pattern = compile (r"[a-z_][\w\$] *" , I )
102102 NUMBER : Pattern = compile (
103103 r"[\+\-]?(\b\d+\.?\d*|\.\d+)(_\w+|d[\+\-]?\d+|e[\+\-]?\d+(_\w+)?)?(?!\w)" ,
104104 I ,
@@ -146,7 +146,7 @@ class FortranRegularExpressions:
146146 # Object regex patterns
147147 CLASS_VAR : Pattern = compile (r"(TYPE|CLASS)[ ]*\(" , I )
148148 DEF_KIND : Pattern = compile (r"(\w*)[ ]*\((?:KIND|LEN)?[ =]*(\w*)" , I )
149- OBJBREAK : Pattern = compile (r"[\/\-(.,+*<>=$ : ]" , I )
149+ OBJBREAK : Pattern = compile (r"[\/\-(.,+*<>=: ]" , I )
150150
151151
152152# TODO: use this in the main code
Original file line number Diff line number Diff line change @@ -70,6 +70,17 @@ def test_hover_parameter():
7070 validate_hover (results , ref_results )
7171
7272
73+ def test_hover_parameter_dollar ():
74+ """Test that hover parameters with dollar in name are recognized correctly"""
75+ string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
76+ file_path = test_dir / "hover" / "parameters.f90"
77+ string += hover_req (file_path , 20 , 31 )
78+ errcode , results = run_request (string , fortls_args = ["--sort_keywords" ])
79+ assert errcode == 0
80+ ref_results = ["```fortran90\n INTEGER(4), PARAMETER :: SIG$ERR = -1\n ```" ]
81+ validate_hover (results , ref_results )
82+
83+
7384def test_hover_parameter_eqnospace ():
7485 """Test that hover parameters display value correctly"""
7586 string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ program params
1818 INTEGER , PARAMETER :: var_multi2 = 1 * &
1919 23 + &
2020 2 / 1 ! comment
21+ INTEGER (4 ), PARAMETER :: SIG$ERR = - 1
2122end program params
You can’t perform that action at this time.
0 commit comments