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

[Feature] Generate cleaner interfaces [sf#6] #141

Closed
lsf37 opened this issue Feb 15, 2015 · 6 comments
Closed

[Feature] Generate cleaner interfaces [sf#6] #141

lsf37 opened this issue Feb 15, 2015 · 6 comments
Labels

Comments

@lsf37
Copy link
Member

@lsf37 lsf37 commented Feb 15, 2015

Reported by deadsea on 2002-02-05 21:44 UTC
I would like to have more control over the interface
that the generated class has. This would involve
controlling the access modifiers on functions and the
javadoc comments.

I would like to be able to make all the variables and
methods private. I would like to be able to provide a
javadoc comment for the class. (you used to be able to
do this by putting it after any import statements, but
now jflex inserts its own there). If everything were
private and a javadoc comment could be added, I could
use jflex generated files without a wrapper.

I suggest the following:
%internalprivate /* makes all methods and class
variables private /
%classcomment{
/
*

  • replacement for the
  • javadoc comment
  • at the head of the generated java file
    */
    %classcomment}

With those two directives I would be happy.
It might be worth considering making the access
modifier and a javadoc comment for each
function/variabl be able to be set individually.
Maybe also a way to set a javadoc comment for each
lexical state, perhaps copy any comment that preceeds
the definition of the lexical state into the generated
java file?

@lsf37 lsf37 changed the title Generate cleaner interfaces [Feature] Generate cleaner interfaces [sf#6] Feb 15, 2015
@lsf37 lsf37 closed this Feb 15, 2015
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Updated by deadsea on 2002-02-05 21:45 UTC

  • labels: --> 311920
  • milestone: --> 104410
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Commented by lsf37 on 2002-02-10 16:17 UTC
Logged In: YES
user_id=93534

I can do the %classcomment thing easily enough, but the
access modifiers are a bit more difficult.

Surely, you do not mean to make strictly everything
private? You wouldn't be able to use the scanner otherwise
(you couldn't even instantiate it if the constructor was
private). It could only work in standalone mode.

I'll have to check, but maybe one can just modify the
skeleton file for stricter access modifiers. This would be
relatively simple to maintain, since it only involves a
simple string replacement.

Setting access modifiers individually in the spec is not
really workable with the current implementation (it would
mean to move everything out of the skeleton file and into
the generator, which makes modifications much harder).

javadoc comments for lexical states might work, but I
don't want to promise anything on that one yet.

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Updated by lsf37 on 2002-02-10 16:17 UTC

  • priority: 5 --> 3
  • labels: 311920 -->
  • milestone: 104410 -->
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Updated by lsf37 on 2002-02-10 16:19 UTC

  • assigned_to: nobody --> lsf37
  • labels: --> generator
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Commented by deadsea on 2002-02-11 13:26 UTC
Logged In: YES
user_id=449980

If everything were private then you could provide public
methods for just what you are interested in:
public getNextToken(){
return nextToken();
}
where nextToken() would be the private method generated by
JFlex. (Thus allowing you to still use the lexer)

The only thing for which this would not work would be the
constructors which I suppose would have to be public in any
case.

I really would like to have a %private directive that would
make everything except the constructors private.

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

Updated by lsf37 on 2004-04-12 12:30 UTC

  • status: open --> closed
@regisd regisd added the enhancement label Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.