pascalabcnet/Parsers/PascalABCParserNewSaushkin/Preprocessor3Yacc.y
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

36 lines
566 B
Plaintext

%{
public List<compiler_directive> compilerDirectives;
public PreprocessorParser(PreprocessorScanner scanner) : base(scanner) { }
%}
%output=Preprocessor3Yacc.cs
%partial
%parsertype PreprocessorParser
%namespace GPPGPreprocessor3
%using PascalABCCompiler.SyntaxTree;
%YYSTYPE Directive
%start directives
%token DIRECTIVE NODIRECTIVE
%%
directives
:
{
Directive.dirs.Clear();
}
| directives DIRECTIVE
{
compilerDirectives.Add(PreprocessorTools.MakeDirective($2.text, $2.loc));
}
| directives NODIRECTIVE
{ }
;
%%