Files
bds.mr.dpg/doc/grammars/multiLexer/javaDocLexer.g
T
2026-01-03 18:31:15 +01:00

76 lines
1.8 KiB
Plaintext

unit JavaDocLexer;
uses
{
dpgTokenStreamSelector;
}
lexer TJavaDocLexer;
options
{
k = 2;
exportVocab = JavaDoc;
filter = true;
}
memberdecl
{
public
Selector : IdpgTokenStreamSelector;
}
// ----------------------------------------------------------------------------
// @param
// ----------------------------------------------------------------------------
PARAM
: "@param" (' ')+ ID
;
// ----------------------------------------------------------------------------
// @exception
// ----------------------------------------------------------------------------
EXCEPTION
: "@exception" (' ')+ ID
;
// ----------------------------------------------------------------------------
// identifier
// ----------------------------------------------------------------------------
protected ID
: ('a'..'z')+
;
// ----------------------------------------------------------------------------
// Star
//
// This rule simply prevents JAVADOC_CLOSE from being called for every '*' in
// a comment. Calling JAVADOC_CLOSE will fail for simple '*' and cause an
// exception, which is slow. In other words, the grammar will work without
// this rule, but is slower.
// ----------------------------------------------------------------------------
STAR
: '*' { _ttype := TT_SKIP; }
;
// ----------------------------------------------------------------------------
// JavaDocClose
// ----------------------------------------------------------------------------
JAVADOC_CLOSE
: "*/" { Selector.Pop; }
;
// ----------------------------------------------------------------------------
// NewLine
// ----------------------------------------------------------------------------
NEWLINE
:
(
'\r' '\n'
| '\r'
| '\n'
)
{
newLine;
_ttype := TT_SKIP;
}
;