Skip to content

Commit da5a983

Browse files
authored
Merge pull request #3847 from BsAtHome/fix_halcompile-number
halcompile: fix parsing numbers
2 parents 194cd80 + 39860f8 commit da5a983

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/hal/utils/halcompile.g

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ parser Hal:
2828
token NAME: "[a-zA-Z_][a-zA-Z0-9_]*"
2929
token STARREDNAME: "[*]*[a-zA-Z_][a-zA-Z0-9_]*"
3030
token HALNAME: "[#a-zA-Z_][-#a-zA-Z0-9_.]*"
31-
token FPNUMBER: "-?([0-9]*\\.[0-9]+|[0-9]+\\.?)([Ee][+-]?[0-9]+)?f?"
32-
token NUMBER: "0x[0-9a-fA-F]+|[+-]?[0-9]+"
31+
token FPNUMBER: "[+-]?((([0-9]*\\.[0-9]+|[0-9]+\\.)([Ee][+-]?[0-9]+)?)|([0-9]+[Ee][+-]?[0-9]+))[fF]?"
32+
token NUMBER: "0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|[+-]?[0-9]+"
3333
token STRING: "\"(\\.|[^\\\"])*\""
3434
token HEADER: "<.*?>"
3535
token POP: "[-()+*/:?]|&&|\\|\\||personality|==|&|!=|<<|<|<=|>>|>|>="
@@ -354,9 +354,9 @@ static int comp_id;
354354

355355
for type, name, array, value in variables:
356356
if array:
357-
print(" %s %s_p[%d];\n" % (type, name, array), file=f)
357+
print(" %s %s_p[%d];" % (type, name, array), file=f)
358358
else:
359-
print(" %s %s_p;\n" % (type, name), file=f)
359+
print(" %s %s_p;" % (type, name), file=f)
360360
if has_data:
361361
print(" void *_data;", file=f)
362362

@@ -955,7 +955,10 @@ def document(filename, outfilebase):
955955
else:
956956
print("*loadrt %s* [*count*=_N_|*names*=_name1_[,_name2_...]]" % comp_name, end='', file=f)
957957
for type, name, default, doc in modparams:
958-
print(" [*%s*=_N_]" % name, end='', file=f)
958+
if type == "dummy":
959+
print(" [*%s*=_value_[,_value_...]]" % name, end='', file=f)
960+
else:
961+
print(" [*%s*=_N_]" % name, end='', file=f)
959962
print("", file=f)
960963

961964
hasparamdoc = False

0 commit comments

Comments
 (0)