private void lexKeyWord() { int offset = reader.offset() - 1; StringBuilder buf = new StringBuilder(); while (true) { int c = reader.read(); if (c < 0) { break; } if (!Util.isIdentifierPart((char)c)) { reader.unread(); break; } buf.Append((char)c); } String s = buf.ToString(); foreach (var rule in keyWordRules) { if (rule.Detected(s, reader)) { tok = rule.token; int len = rule.getLen(s, reader); reader.setoffset(offset + len); OffsetLenAttr = new Tuple <int, int, Rule>(offset, len, rule); break; } } }
public override int getLen(string sequence, LexerReader reader) { if (sequence == this.start) { return(base.getLen(sequence, reader)); } else { return(reader.offset()); } }
public override int getLen(string sequence, LexerReader reader) { int off = reader.offset(); int index = reader.Src.ToString().IndexOfAny(c, off); if (index < 0) { return(reader.Src.Length - off); } else { return(index - off); } }
public override int getLen(string sequence, LexerReader reader) { int off = reader.offset(); int index = reader.Src.IndexOf(this.end, off); if (index < 0) { return(reader.Src.Length - (off - this.start.Length)); } else { return(index - (off - this.start.Length) + this.end.Length); } }
public override int getLen(string sequence, LexerReader reader) { if (sequence == this.start) { return base.getLen(sequence, reader); } else { return reader.offset(); } }
public override int getLen(string sequence, LexerReader reader) { int off = reader.offset(); int index = reader.Src.ToString().IndexOfAny(c, off); if (index < 0) { return reader.Src.Length - off; } else { return index - off; } }
public override int getLen(string sequence, LexerReader reader) { return reader.Src.Length - reader.offset() + this.start.Length; }
public override int getLen(string sequence, LexerReader reader) { int off = reader.offset(); int index = reader.Src.IndexOf(this.end, off); if (index < 0) { return reader.Src.Length - (off-this.start.Length); } else { return index - (off - this.start.Length) + this.end.Length; } }
public override int getLen(string sequence, LexerReader reader) { return(reader.Src.Length - reader.offset() + this.start.Length); }