好吧,我自己解决了,给后人回答。
override def token: CeeLexer.Parser[Token] = controlLine
// | ... (where ... is whatever you want to keep of the original method)
def controlLine = hashInclude
def hashInclude : CeeLexer.Parser[HashInclude] =
('#' ~ word("include") ~ rep(nonEolws)~'\"' ~ rep(chrExcept('\"', '\n', EofCh)) ~ '\"' ~ '\n' |
'#' ~ word("include") ~ rep(nonEolws)~'<' ~ rep(chrExcept('>', '\n', EofCh)) ~ '>' ~ '\n' ) ^^ {
case hash~include~whs~openQ~fname~closeQ~eol => // code to handle #include
}