-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pragmas #115
Pragmas #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some remarks
@@ -1806,6 +1806,17 @@ void CodeStringExpr ( | |||
PushExpr( string ); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit messsage: "Function can contain pragmas ..." -> Functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Int ix = PushValue(pragma); | ||
WRITE_EXPR(pragmaexpr, 0, ix); | ||
PushStat( pragmaexpr ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is completely new code, so you are free to clang-format it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
CodePragma( pragma ); | ||
} else { | ||
// Push a void when interpreting | ||
PushVoidObj(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't do it, you run into the assertion assert( LEN_PLIST(STATE(StackObj)) == 1 );
in IntrEnd
if you enter a pragma in plain interactive mode, i.e., in a GAP session like
gap> #@ foo
} | ||
else { | ||
Match(S_PRAGMA, "", 0L ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While a pragma is a statement, you have to Match
the statement end to get the next symbol. However, a pragma does not end with a semicolon, so we cannot get the next symbol by matching semicolon.
@@ -2854,6 +2861,7 @@ rec( | |||
stats := rec( | |||
statements := [ rec( | |||
obj := rec( | |||
string := "1.0", | |||
type := "T_FLOAT_EXPR_EAGER", | |||
value := 1 ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused as to why value
is 1 here... I'd expect 1.
or 1.0
... huh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the other PR #114 and should maybe be discussed there.
@@ -1944,7 +1942,7 @@ void CodeFloatExpr(Obj s) | |||
CodeEagerFloatExpr(s, mark); | |||
} | |||
else { | |||
CodeLazyFloatExpr(s); | |||
CodeLazyFloatExpr(s,1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeLazyFloatExpr(s,1); | |
CodeLazyFloatExpr(s, 1); |
@@ -1909,7 +1904,10 @@ static void CodeLazyFloatExpr(Obj str) | |||
WRITE_EXPR(fl, 1, PushValue(str)); | |||
|
|||
/* push the expression */ | |||
PushExpr(fl); | |||
if(pushExpr){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(pushExpr){ | |
if(pushExpr) { |
Obj value = GET_VALUE_FROM_CURRENT_BODY(READ_EXPR(expr, 0)); | ||
Obj string = GET_VALUE_FROM_CURRENT_BODY(READ_EXPR(expr, 1)); | ||
AssPRec(result, RNamName("value"), value); | ||
AssPRec(result, RNamName("string"), string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "mark" character is not decoded here, as returned by (Char)READ_EXPR(expr, 2)
...
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #115 +/- ##
===========================================
- Coverage 69.17% 41.76% -27.42%
===========================================
Files 633 99 -534
Lines 305868 40201 -265667
===========================================
- Hits 211593 16789 -194804
+ Misses 94275 23412 -70863
|
to indicate that the statement stack is complete and does not need any more additions.
Functions can contain pragmas, i.e., comments which are stored inside the "compiled" function as a string
I put this on top if the syntax tree PR #114 to see if you can code/decode the pragmas