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

ConsPred rule in CrySL grammar #36

Open
rbonifacio opened this issue Jul 24, 2020 · 1 comment
Open

ConsPred rule in CrySL grammar #36

rbonifacio opened this issue Jul 24, 2020 · 1 comment

Comments

@rbonifacio
Copy link

Context: We are working on the XText version of MetaCrySL.

Reading the current CrySL grammar, we found:

ConsPred returns LiteralExpression:
	(consPred = "alg("lit=LiteralExpression ")"| consPred = "mode("lit=LiteralExpression ")" | ...
	| lit=LiteralExpression ;

Is there any reason for not generalizing this definition for any "function"? I mean, perhaps something like:

ConsPred returns LiteralExpression:
	 (consPred = ID "(" lit = LiteralExpression ")"
	| lit=LiteralExpression ;
@rbonifacio rbonifacio changed the title ConsPred rule ConsPred rule in CrySL grammar Jul 24, 2020
@marvinvo
Copy link

I think it is coming from the definition of JCA's getInstance() parameter strings. They are defined by the three sections: getInstance("alg/mode/pad").

https://github.com/eclipse-cognicrypt/CogniCrypt/blob/ef64a0f2aa7bd54fdc70ae518691cfadf7f47f53/plugins/de.cognicrypt.crysl.handler/src/main/java/de/cognicrypt/crysl/reader/CrySLParser.java#L389
As you can also see here, the predefined function names are used to identify the index for a splitter, which can probably cut out the value at the correct section in such a getInstance string.

Hope that helps!

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