Exemplo n.º 1
0
 private Lexem TransformRegexLiteral(Lexem lex)
 {
     return(new Lexem(LexemType.Regex, lex.StartLocation, lex.EndLocation, lex.Value.Replace(@"##", "#")));
 }
Exemplo n.º 2
0
 private bool Equals(Lexem other)
 {
     return(Type.Equals(other.Type) && string.Equals(Value, other.Value));
 }
Exemplo n.º 3
0
        private Lexem transformCharLiteral(Lexem lex)
        {
            var value = lex.Value;
            if (value.Length < 3 || value.Length > 4)
                error(LexerMessages.IncorrectCharLiteral);

            value = value[1] == '\\'
                ? escapeChar(value[2]).ToString()
                : value[1].ToString();

            return new Lexem(LexemType.Char, lex.StartLocation, lex.EndLocation, value);
        }
Exemplo n.º 4
0
 private Lexem transformRegexLiteral(Lexem lex)
 {
     return new Lexem(LexemType.Regex, lex.StartLocation, lex.EndLocation, lex.Value.Replace(@"\#", "#"));
 }
Exemplo n.º 5
0
 private bool Equals(Lexem other)
 {
     return Type.Equals(other.Type) && string.Equals(Value, other.Value);
 }