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

Parsing cfscript functions with hints renders multiple errors. #236

Closed
sdurette opened this issue Feb 2, 2017 · 2 comments
Closed

Parsing cfscript functions with hints renders multiple errors. #236

sdurette opened this issue Feb 2, 2017 · 2 comments

Comments

@sdurette
Copy link

sdurette commented Feb 2, 2017

I'm not sure if this belongs here or in the cfparser repository. When processing cfscript functions such as:

01: public numeric function test(
02: required numeric inNum
03: )
04: output=false
05: hint="I am a test function."
06: {
07: return ARGUMENTS.inNum + 1;
08:}
09:
10: public numeric function test2(
...
There are several errors that are coming up that possibly shouldn't.

  1. "Function test is missing a hint". Line 01. There is a hint there and it is supposedly in the correct place. Both Lucee and ACF11 handle this code no problem.
  2. "Unable to parse". Line 04. Same as previous.
  3. "Variable hint is not declared with a var statement". Line 05. This is not a variable declaration.
  4. "End of statement(;) expected instead of {". Line 06. Caused by the hint on the previous line.
  5. "End of statement(;) expected instead of test2". Line 10. Caused by previous function not being parsed correctly.

I'm pretty sure that the script based code is correct and most of the projects I'm working on prefer the script syntax.

Note: Getting rid of the output=false and hint="I am a test function." gets rid of those errors and replaces it with "Function test is missing a hint". Line 01.

Please let me know if this is in the right project, or if there is a different one I should submit this to.

Thanks,
Steve

@sdurette
Copy link
Author

sdurette commented Feb 2, 2017

Just wanted to leave a note... According to what I have been looking at there are two valid ways to put hints into functions. The way I used above (verified by the following page: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSE99A664D-44E3-44d1-92A0-5FDF8D82B55C.html) and by using comments immediately before the function in the format

/*
 * @hint "I am a test function."
 * @inNum "I am the test argument."
 */

I believe that ACF supports both for component introspection, but I'm not sure about LUCEE. I can attempt to verify later.

ryaneberly added a commit to cfparser/cfparser that referenced this issue Feb 2, 2017
@ryaneberly
Copy link
Contributor

ryaneberly commented Feb 2, 2017

Good catch @sdurette . I think if you change:
output=false
to
output="false"

I think it will work. However, I fixed the parsing if cfparser/dev as well

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