Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse errors when last element in structure has trailing comma #263

Closed
mpaluchowski opened this issue Apr 14, 2017 · 1 comment
Closed

Comments

@mpaluchowski
Copy link
Contributor

When a structure is created shorthand, where the last element has a trailing comma:

foo = {
  bar = 1,
  baz = 2,
};

(which seems to work fine in Railo and is commonly supported by other languages), this triggers a number of parsing errors:

<issue severity="ERROR" id="PARSE_ERROR" message="PARSE_ERROR" category="CFLint" abbrev="PE">
  <location file="C:\Inbox\cflint-test\.\test.cfc" fileName="test.cfc" function="" column="2" line="7" message="Unable to parse" variable="">
    <Expression><![CDATA[no viable alternative at input '{\r\n\t\t    bar=1,\r\n\t\t    baz=2,\r\n\t\t}']]></Expression>
  </location>
</issue>
<issue severity="ERROR" id="MISSING_SEMI" message="MISSING_SEMI" category="CFLint" abbrev="MS">
  <location file="C:\Inbox\cflint-test\.\test.cfc" fileName="test.cfc" function="" column="13" line="5" message="End of statement(;) expected instead of ," variable="">
    <Expression><![CDATA[,]]></Expression>
  </location>
</issue>
<issue severity="ERROR" id="MISSING_SEMI" message="MISSING_SEMI" category="CFLint" abbrev="MS">
  <location file="C:\Inbox\cflint-test\.\test.cfc" fileName="test.cfc" function="" column="13" line="6" message="End of statement(;) expected instead of ," variable="">
    <Expression><![CDATA[,]]></Expression>
  </location>
</issue>

The same applies with nested structures. There will be similar errors reported when this is scanned:

var foo = {
  bar = 1,
  baz = {
    foo = 2,
  }
};
ryaneberly added a commit to cfparser/cfparser that referenced this issue Apr 19, 2017
@ryaneberly
Copy link
Contributor

fixed in cfparser 2.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants