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
d2e93452
Commit
d2e93452
authored
11 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
preprocessor: match dates in dynare syntax
parent
fae00ea7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
DynareFlex.ll
+21
-1
21 additions, 1 deletion
DynareFlex.ll
with
21 additions
and
1 deletion
DynareFlex.ll
+
21
−
1
View file @
d2e93452
...
...
@@ -69,6 +69,9 @@ string eofbuff;
//
Increments
location
counter
for
every
token
read
#
define
YY_USER_ACTION
location_increment
(
yylloc
,
yytext
)
;
%
}
DATE
-?
[
0-9
]
+
([
YyAa
]
|
[
Mm
]([
1-9
]
|
1
[
0-2
])
|
[
Qq
][
1-4
]
|
[
Ww
]([
1-9
]{
1
}
|
[
1-4
][
0-9
]
|
5
[
0-2
]))
%%
/
*
Code
put
at
the
beginning
of
yylex
()
*
/
%
{
...
...
@@ -205,6 +208,23 @@ string eofbuff;
<INITIAL>corr {BEGIN DYNARE_STATEMENT; return token::CORR;}
/* Inside of a Dynare statement */
<DYNARE_STATEMENT>{DATE} {
char *yycopy = strdup(yytext);
char *uput = yycopy + yyleng;
unput(')');
unput('\'');
while (uput > yycopy)
unput(*--uput);
unput('\'');
unput('(');
unput('s');
unput('e');
unput('t');
unput('a');
unput('d');
free( yycopy );
}
<DYNARE_STATEMENT>${DATE} { yylloc->step(); *yyout << yytext + 1; }
<DYNARE_STATEMENT>dates {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->string_val = new string("
dates
");}
<DYNARE_STATEMENT>file {return token::FILE;}
<DYNARE_STATEMENT>datafile {return token::DATAFILE;}
...
...
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