/* $Id$ */ package org.noreply.fancydress.directory.parser; import java_cup.runtime.*; %% %class DirectoryLexer %public %line %column %cupsym DirectorySymbols %cup %{ private Symbol symbol(int type) { return new Symbol(type, yyline, yycolumn); } private Symbol symbol(int type, Object value) { return new Symbol(type, yyline, yycolumn, value); } %} Space = [ \t]+ Identifier = ([!-9] | [;-Z] | \\ | \^ | [_-~])+ %% { {Space} { return symbol(DirectorySymbols.SPACE, new String(yytext())); } "[" { return symbol(DirectorySymbols.LEFT_BRACKET, new String(yytext())); } "]" { return symbol(DirectorySymbols.RIGHT_BRACKET, new String(yytext())); } "\n" { return symbol(DirectorySymbols.NL); } "\r" { return symbol(DirectorySymbols.CR); } ":" { return symbol(DirectorySymbols.COLON, new String(yytext())); } {Identifier} { return symbol(DirectorySymbols.IDENTIFIER, new String(yytext())); } } [^] { throw new Error("Illegal character <"+yytext()+">"); }