[antlr-interest] why is second input line not matched?
Oliver Kowalke
oliver.kowalke at gmx.de
Sat Jan 8 02:04:16 PST 2005
Hello,
I need some help. I've no idea (newbie to grammar writing) why the second
input line isn't matched!
thank you for your hints!
with best regards
Oliver
--- input ---
fileVersion 1 0;
FileTimeStamp 0 0;
--- grammar ---
header "pre_include_hpp"
{
#include <iostream>
}
options
{
language="Cpp";
namespace="kla";
}
/////////////////////////////////////////////////////////////////////
// Lexer
/////////////////////////////////////////////////////////////////////
class KlarfLexer extends Lexer;
options
{
k=2;
exportVocab=KLARF;
charVocabulary='\u0000'..'\u007F';
caseSensitive=false;
caseSensitiveLiterals=false;
}
DELIM
: ( ' '
| '\t'
| '\f'
| ( "\r\n"
| '\r'
| '\n'
)
{ newline(); }
)
;
RECORD
: ( ~( ' ' | ';' | '\r' | '\n' | '\t' | '\f' | '"' ) ( ~( ' ' | ';' | '\r'
| '\t' | '\f' | '\n' ) )* )
| ('"' (~'"')* '"')+
;
EODS
: ';'
;
/////////////////////////////////////////////////////////////////////
// Parser
/////////////////////////////////////////////////////////////////////
class KlarfParser extends Parser;
options
{
k=1;
exportVocab=KLARF;
}
parse
: ( dataset (EODS)+ )+
;
dataset
{ std::cout << "begin of dataset" << std::endl; }
: record ( (DELIM)+ record)*
{ std::cout << "end of dataset" << std::endl; }
;
record
: r:RECORD
{ std::cout << r->getText() << std::endl; }
;
--
+++ GMX - die erste Adresse für Mail, Message, More +++
1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
More information about the antlr-interest
mailing list