Exemplo n.º 1
0
        public ScanLiteral(string literal)
        {
            this.IsLiteral = true;

            this.literal      = literal;
            this.pattern      = ScannerUtils.Escape(literal);
            this.regexPattern = Regex.Escape(literal);
        }
Exemplo n.º 2
0
        // TODO: Logic should not be present in attribute constructor
        public LiteralAttribute(string text, Disambiguation disambiguation = Disambiguation.Exclusive)
        {
            base.LiteralText    = text;
            base.Disambiguation = disambiguation;

            // Look-ahead is needed because .net Regex does not select longest match but the first alternative.
            this.RegexPattern = Regex.Escape(text);
            if (text != "(" && text != ")")
            {
                this.RegexPattern += @"(?=[ \t\(\)"";]|$)";
            }

            this.Pattern = ScannerUtils.Escape(text);
        }