Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
preprocessor
Commits
c6beb6c5
Verified
Commit
c6beb6c5
authored
5 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
macro processor: ignore `@#line` directive
parent
5a5817b4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#2398
passed
5 years ago
Stage: build
Stage: prepare
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/macro/Parser.yy
+7
-1
7 additions, 1 deletion
src/macro/Parser.yy
src/macro/Tokenizer.ll
+1
-0
1 addition, 0 deletions
src/macro/Tokenizer.ll
with
8 additions
and
1 deletion
src/macro/Parser.yy
+
7
−
1
View file @
c6beb6c5
...
...
@@ -59,7 +59,7 @@ using namespace macro;
%token FOR ENDFOR IF IFDEF IFNDEF ELSEIF ELSE ENDIF TRUE FALSE
%token INCLUDE INCLUDEPATH DEFINE EQUAL D_ECHO ERROR
%token COMMA LPAREN RPAREN LBRACKET RBRACKET WHEN
%token BEGIN_EVAL END_EVAL ECHOMACROVARS SAVE
%token BEGIN_EVAL END_EVAL ECHOMACROVARS SAVE
LINE
%token EXP LOG LN LOG10 SIN COS TAN ASIN ACOS ATAN
%token SQRT CBRT SIGN MAX MIN FLOOR CEIL TRUNC SUM MOD
...
...
@@ -145,6 +145,12 @@ directive_one_line : INCLUDE expr
{ $$ = make_shared<EchoMacroVars>(true, driver.env, @$); }
| ECHOMACROVARS LPAREN SAVE RPAREN name_list
{ $$ = make_shared<EchoMacroVars>(true, $5, driver.env, @$); }
| LINE QUOTED_STRING NUMBER
{
// `@#line` is ignored; adjust newlines in output to accord
auto l = static_cast<Tokenizer::parser::location_type>(@$);
$$ = make_shared<TextNode>(string(l.end.line - l.begin.line + 1, '\n'), driver.env, @$);
}
;
name_list : NAME
...
...
This diff is collapsed.
Click to expand it.
src/macro/Tokenizer.ll
+
1
−
0
View file @
c6beb6c5
...
...
@@ -64,6 +64,7 @@ CONT \\\\{SPC}*
yylloc-
>
step
()
;
%
}
<
directive
>
line
{
BEGIN
(
expr
)
; return token::LINE; }
<
directive
>
include
{
BEGIN
(
expr
)
; return token::INCLUDE; }
<
directive
>
includepath
{
BEGIN
(
expr
)
; return token::INCLUDEPATH; }
<
directive
>
define
{
BEGIN
(
expr
)
; return token::DEFINE; }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment