Ejemplo n.º 1
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                if (tc.Char() == '\'')
                {
                    // single line comment
                    tc.SkipRemainder();
                }
                else if (tc.Char() == '"')
                {
                    this.status = stString;
                    tc.Next();
                    this.ParseString(tc);
                }
                else if (language.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }
Ejemplo n.º 2
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.EndOfLine)
     {
         // multi-line comment
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             this.status = stMultiLineComment;
             tc.Skip(2);
             this.ParseMultiLineComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '@' && tc.NChar() == '"')
         {
             this.status = stMultiLineString;
             tc.Skip(2);
             this.ParseMultiLineString(tc);
         }
         else if (tc.Char() == '$' && tc.NChar() == '"')
         {
             // Roslyn interpolated string
             this.parsingExpression = false;
             this.status            = stIString;
             tc.Skip(2);
             return(this.ParseInterpolatedString(tc, ref pos));
         }
         else if (tc.Char() == '$' && tc.NChar() == '@' && tc.NNChar() == '"')
         {
             this.status = stMultiLineString;
             tc.Skip(3);
             this.ParseMultiLineString(tc);
         }
         else if (tc.Char() == '"')
         {
             this.status = stString;
             tc.Next();
             this.ParseString(tc);
         }
         else if (tc.Char() == '\'')
         {
             this.status = stString;
             tc.Next();
             this.ParseCharLiteral(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition, EncodedState());
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                if (tc.Char() == '#')
                {
                    tc.SkipRemainder();
                }
                else if ((tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"') ||
                         (tc.Char() == '\'' && tc.NChar() == '\'' && tc.NNChar() == '\''))
                {
                    this.status    = stMultiLineString;
                    this.quoteChar = tc.Char();
                    tc.Skip(3);
                    this.ParseMultiLineString(tc);
                }
                else if (tc.Char() == '\'' || tc.Char() == '"')
                {
                    this.status    = stString;
                    this.quoteChar = tc.Char();
                    tc.Next();
                    this.ParseString(tc);
                }
                else if (lang.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }
Ejemplo n.º 4
0
        private bool Parse(ITextChars tc, ref CharPos pos)
        {
            while (!tc.AtEnd)
            {
                // Comment.
                if (tc.Char() == '#')
                {
                    tc.SkipRemainder();
                }

                // String.
                else if (tc.Char() == '"')
                {
                    tc.Next();

                    this.status = State.MultiLineString;
                    this.String(tc);

                    continue;
                }

                // Braces.
                else if (this.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    pos = new CharPos(tc.Char(), tc.AbsolutePosition);
                    tc.Next();
                    return(true);
                }

                // Code.
                tc.Next();
            }
            return(false);
        }
Ejemplo n.º 5
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                // multi-line comment
                if (tc.Char() == '/' && tc.NChar() == '*')
                {
                    this.status = stMultiLineComment;
                    tc.Skip(2);
                    this.ParseMultiLineComment(tc);
                }
                else if (tc.Char() == '-' && tc.NChar() == '-')
                {
                    tc.SkipRemainder();
                }
                else if (tc.Char() == '\'')
                {
                    this.status = stString;
                    tc.Next();
                    this.ParseString(tc);
                }
                else if (lang.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }
Ejemplo n.º 6
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.AtEnd)
     {
         // multi-line comment
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             this.status = stMultiLineComment;
             tc.Skip(2);
             this.ParseMultiLineComment(tc);
         }
         else if (tc.Char() == '-' && tc.NChar() == '-')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '\'')
         {
             this.status = stString;
             tc.Next();
             this.ParseString(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.AtEnd)
     {
         if (tc.Char() == '!')
         {
             // single line comment
             tc.SkipRemainder();
         }
         else if (tc.Char() == '\'')
         {
             this.status = stStringSingle;
             tc.Next();
             ParseStringSingle(tc);
         }
         else if (tc.Char() == '"')
         {
             this.status = stStringDouble;
             tc.Next();
             ParseStringDouble(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 8
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.AtEnd)
     {
         // multi-line comment
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             this.status = stMultiLineComment;
             tc.Skip(2);
             this.ParseMultiLineComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '/' && CheckPrevious(tc.PreviousToken()))
         {
             // probably a regular expression literal
             tc.Next();
             this.status = stRegex;
             this.ParseRegex(tc);
         }
         else if (tc.Char() == '"')
         {
             this.status = stString;
             tc.Next();
             this.ParseString(tc);
         }
         else if (tc.Char() == '\'')
         {
             this.status = stString;
             tc.Next();
             this.ParseCharLiteral(tc);
         }
         else if (tc.Char() == '`')
         {
             this.status = stIString;
             tc.Next();
             return(this.ParseInterpolatedString(tc, ref pos));
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 9
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                // multi-line comment
                if (tc.Char() == '/' && tc.NChar() == '*')
                {
                    this.status = stMultiLineComment;
                    tc.Skip(2);
                    this.ParseMultiLineComment(tc);
                }
                else if (tc.Char() == '/' && tc.NChar() == '/')
                {
                    tc.SkipRemainder();
                }
                else if (tc.Char() == '/' && CheckPrevious(tc.PreviousToken()))
                {
                    // probably a regular expression literal
                    tc.Next();
                    this.status = stRegex;
                    this.ParseRegex(tc);
                }
                else if (tc.Char() == '"')
                {
                    this.status = stString;
                    tc.Next();
                    this.ParseString(tc);
                }
                else if (tc.Char() == '\'')
                {
                    this.status = stString;
                    tc.Next();
                    this.ParseCharLiteral(tc);
                }
                else if (lang.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }
Ejemplo n.º 10
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.EndOfLine)
     {
         // multi-line comment
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             this.status = stMultiLineComment;
             tc.Skip(2);
             this.ParseMultiLineComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '"')
         {
             this.status = stString;
             tc.Next();
             this.ParseString(tc);
         }
         else if (Char.IsDigit(tc.Char()) && tc.NChar() == '\'')
         {
             // this is a C++ 14 digit separator, such as 1'000'000
             tc.Skip(2);
         }
         else if (tc.Char() == '\'')
         {
             this.status = stString;
             tc.Next();
             this.ParseCharLiteral(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 11
0
 private IEnumerable<CharPos> ParseText(ITextChars tc)
 {
     while ( !tc.EndOfLine ) {
     if ( tc.Char() == '\'' ) {
       // single line comment
       tc.SkipRemainder();
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( braceList.IndexOf(tc.Char()) >= 0 ) {
       yield return new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
     } else {
       tc.Next();
     }
       }
 }
Ejemplo n.º 12
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     pos = CharPos.Empty;
     while (!tc.AtEnd)
     {
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             this.state = stComment;
             tc.Skip(2);
             ParseComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             // CSS doesn't really support single-line comments,
             // but SASS does, and it doesn't harm too
             // much to implement it as a single thing
             tc.SkipRemainder();
         }
         else if (tc.Char() == '"')
         {
             this.state = stDoubleQuotedString;
             tc.Next();
             ParseDString(tc);
         }
         else if (tc.Char() == '\'')
         {
             this.state = stSingleQuotedString;
             tc.Next();
             ParseString(tc);
         }
         else if (this.BraceList.Contains(tc.Char()))
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 13
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     if ( tc.Char() == '\'' ) {
       // single line comment
       tc.SkipRemainder();
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 14
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                if (tc.Char() == '/' && tc.NChar() == '*')
                {
                    this.state = stComment;
                    tc.Skip(2);
                    ParseComment(tc);
                }
                else if (tc.Char() == '/' && tc.NChar() == '/')
                {
                    // CSS doesn't really support single-line comments,
                    // but SASS does, and it doesn't harm too
                    // much to implement it as a single thing
                    tc.SkipRemainder();
                }
                else if (tc.Char() == '"')
                {
                    this.state = stDoubleQuotedString;
                    tc.Next();
                    ParseDString(tc);
                }
                else if (tc.Char() == '\'')
                {
                    this.state = stSingleQuotedString;
                    tc.Next();
                    ParseString(tc);
                }
                else if (lang.BraceList.Contains(tc.Char()))
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }
Ejemplo n.º 15
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.EndOfLine)
     {
         if (tc.Char() == '/' && tc.NChar() == '*')
         {
             tc.Skip(2);
             status = stMultiLineComment;
             ParseMultilineComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '\'')
         {
             status = stString;
             tc.Next();
             ParseCharLiteral(tc);
         }
         else if (tc.Char() == '"')
         {
             status = stString;
             tc.Next();
             ParseString(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 16
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.AtEnd)
     {
         if (tc.Char() == '#')
         {
             tc.SkipRemainder();
         }
         else if ((tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"') ||
                  (tc.Char() == '\'' && tc.NChar() == '\'' && tc.NNChar() == '\''))
         {
             this.status    = stMultiLineString;
             this.quoteChar = tc.Char();
             tc.Skip(3);
             this.ParseMultiLineString(tc);
         }
         else if (tc.Char() == '\'' || tc.Char() == '"')
         {
             this.status    = stString;
             this.quoteChar = tc.Char();
             tc.Next();
             this.ParseString(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 17
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '@' && tc.NChar() == '"' ) {
       this.status = stString;
       this.multiLine = true;
       tc.Skip(2);
       this.ParseMultiLineString(tc);
     } else if ( tc.Char() == '$' && tc.NChar() == '"' ) {
       // Roslyn interpolated string
       this.parsingExpression = false;
       this.status = stIString;
       tc.Skip(2);
       return this.ParseInterpolatedString(tc, ref pos);
     } else if ( tc.Char() == '$' && tc.NChar() == '@' && tc.NNChar() == '"' ) {
       this.status = stIString;
       this.multiLine = true;
       this.parsingExpression = false;
       tc.Skip(3);
       return this.ParseInterpolatedString(tc, ref pos);
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( tc.Char() == '\'' ) {
       this.status = stString;
       tc.Next();
       this.ParseCharLiteral(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition, EncodedState());
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 18
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '-' && tc.NChar() == '-' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '\'' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 19
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '(' && tc.NChar() == '*' && tc.NNChar() != ')') {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '@' && tc.NChar() == '"' ) {
       this.status = stVerbatimString;
       tc.Skip(2);
       this.ParseVerbatimString(tc);
     } else if ( tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"' ) {
       this.status = stTripleQuotedString;
       tc.Skip(3);
       this.ParseTripleQuotedString(tc);
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( tc.Char() == '<' && tc.NChar() == '\'') {
       // this is just a generic parameter, so skip it already
       tc.Skip(2);
     } else if ( Char.IsLetterOrDigit(tc.Char()) && tc.NChar() == '\'' ) {
       // identifier like c'
       tc.Skip(2);
     } else if ( tc.Char() == '\'' ) {
       this.status = stChar;
       tc.Next();
       this.ParseCharLiteral(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 20
0
 public bool Extract(ITextChars text, ref CharPos pos)
 {
     text.SkipRemainder();
       return false;
 }
Ejemplo n.º 21
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while (!tc.AtEnd)
     {
         // multi-line comment
         if (tc.Char() == '(' && tc.NChar() == '*' && tc.NNChar() != ')')
         {
             this.status = stMultiLineComment;
             tc.Skip(2);
             this.ParseMultiLineComment(tc);
         }
         else if (tc.Char() == '/' && tc.NChar() == '/')
         {
             tc.SkipRemainder();
         }
         else if (tc.Char() == '@' && tc.NChar() == '"')
         {
             this.status = stVerbatimString;
             tc.Skip(2);
             this.ParseVerbatimString(tc);
         }
         else if (tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"')
         {
             this.status = stTripleQuotedString;
             tc.Skip(3);
             this.ParseTripleQuotedString(tc);
         }
         else if (tc.Char() == '"')
         {
             this.status = stString;
             tc.Next();
             this.ParseString(tc);
         }
         else if (tc.Char() == '<' && tc.NChar() == '\'')
         {
             // this is just a generic parameter, so skip it already
             tc.Skip(2);
         }
         else if (Char.IsLetterOrDigit(tc.Char()) && tc.NChar() == '\'')
         {
             // identifier like c'
             tc.Skip(2);
         }
         else if (tc.Char() == '\'')
         {
             this.status = stChar;
             tc.Next();
             this.ParseCharLiteral(tc);
         }
         else if (this.BraceList.IndexOf(tc.Char()) >= 0)
         {
             pos = new CharPos(tc.Char(), tc.AbsolutePosition);
             tc.Next();
             return(true);
         }
         else
         {
             tc.Next();
         }
     }
     return(false);
 }
Ejemplo n.º 22
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '/' && CheckPrevious(tc.PreviousToken()) ) {
       // probably a regular expression literal
       tc.Next();
       this.status = stRegex;
       this.ParseRegex(tc);
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( tc.Char() == '\'' ) {
       this.status = stString;
       tc.Next();
       this.ParseCharLiteral(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 23
0
 private IEnumerable<CharPos> ParseText(ITextChars tc)
 {
     while ( !tc.EndOfLine ) {
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.state = stComment;
       tc.Skip(2);
       ParseComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       // CSS doesn't really support single-line comments,
       // but SASS does, and it doesn't harm too
       // much to implement it as a single thing
       tc.SkipRemainder();
     } else if ( tc.Char() == '"' ) {
       this.state = stDoubleQuotedString;
       tc.Next();
       ParseDString(tc);
     } else if ( tc.Char() == '\'' ) {
       this.state = stSingleQuotedString;
       tc.Next();
       ParseString(tc);
     } else if ( braceList.Contains(tc.Char()) ) {
       yield return new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
     } else {
       tc.Next();
     }
       }
 }
Ejemplo n.º 24
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( Char.IsDigit(tc.Char()) && tc.NChar() == '\'' ) {
       // this is a C++ 14 digit separator, such as 1'000'000
       tc.Skip(2);
     } else if ( tc.Char() == '\'' ) {
       this.status = stString;
       tc.Next();
       this.ParseCharLiteral(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 25
0
 private IEnumerable<CharPos> ParseText(ITextChars tc)
 {
     while ( !tc.EndOfLine ) {
     // multi-line comment
     if ( tc.Char() == '<' && tc.NChar() == '#' ) {
       this.status = stMultiLineComment;
       tc.Skip(2);
       this.ParseMultiLineComment(tc);
     } else if ( tc.Char() == '#' ) {
       tc.SkipRemainder();
     } else if ( tc.Char() == '@' && tc.NChar() == '\'' ) {
       this.status = stHereString;
       tc.Skip(2);
       this.ParseHereString(tc);
     } else if ( tc.Char() == '@' && tc.NChar() == '"' ) {
       this.status = stHereExpandableString;
       tc.Skip(2);
       this.ParseHereExpandableString(tc);
     } else if ( tc.Char() == '"' ) {
       this.status = stString;
       tc.Next();
       this.ParseExpandableString(tc);
     } else if ( tc.Char() == '\'' ) {
       this.status = stString;
       tc.Next();
       this.ParseString(tc);
     } else if ( braceList.IndexOf(tc.Char()) >= 0 ) {
       yield return new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
     } else {
       tc.Next();
     }
       }
 }
Ejemplo n.º 26
0
 private IEnumerable<CharPos> ParseText(ITextChars tc)
 {
     while ( !tc.EndOfLine ) {
     if ( tc.Char() == '#' ) {
       tc.SkipRemainder();
     } else if ( (tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"')
          || (tc.Char() == '\'' && tc.NChar() == '\'' && tc.NNChar() == '\'') ) {
       this.status = stMultiLineString;
       this.quoteChar = tc.Char();
       tc.Skip(3);
       this.ParseMultiLineString(tc);
     } else if ( tc.Char() == '\'' || tc.Char() == '"' ) {
       this.status = stString;
       this.quoteChar = tc.Char();
       tc.Next();
       this.ParseString(tc);
     } else if ( braceList.IndexOf(tc.Char()) >= 0 ) {
       yield return new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
     } else {
       tc.Next();
     }
       }
 }
Ejemplo n.º 27
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     pos = CharPos.Empty;
       while ( !tc.EndOfLine ) {
     if ( tc.Char() == '/' && tc.NChar() == '*' ) {
       this.state = stComment;
       tc.Skip(2);
       ParseComment(tc);
     } else if ( tc.Char() == '/' && tc.NChar() == '/' ) {
       // CSS doesn't really support single-line comments,
       // but SASS does, and it doesn't harm too
       // much to implement it as a single thing
       tc.SkipRemainder();
     } else if ( tc.Char() == '"' ) {
       this.state = stDoubleQuotedString;
       tc.Next();
       ParseDString(tc);
     } else if ( tc.Char() == '\'' ) {
       this.state = stSingleQuotedString;
       tc.Next();
       ParseString(tc);
     } else if ( this.BraceList.Contains(tc.Char()) ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 28
0
 public bool Extract(ITextChars text, ref CharPos pos)
 {
     text.SkipRemainder();
     return(false);
 }
Ejemplo n.º 29
0
 private bool ParseText(ITextChars tc, ref CharPos pos)
 {
     while ( !tc.EndOfLine ) {
     if ( tc.Char() == '#' ) {
       tc.SkipRemainder();
     } else if ( (tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"')
          || (tc.Char() == '\'' && tc.NChar() == '\'' && tc.NNChar() == '\'') ) {
       this.status = stMultiLineString;
       this.quoteChar = tc.Char();
       tc.Skip(3);
       this.ParseMultiLineString(tc);
     } else if ( tc.Char() == '\'' || tc.Char() == '"' ) {
       this.status = stString;
       this.quoteChar = tc.Char();
       tc.Next();
       this.ParseString(tc);
     } else if ( this.BraceList.IndexOf(tc.Char()) >= 0 ) {
       pos = new CharPos(tc.Char(), tc.AbsolutePosition);
       tc.Next();
       return true;
     } else {
       tc.Next();
     }
       }
       return false;
 }
Ejemplo n.º 30
0
        private IEnumerable <CharPos> ParseText(ITextChars tc)
        {
            while (!tc.EndOfLine)
            {
                // multi-line comment
                if (tc.Char() == '(' && tc.NChar() == '*')
                {
                    this.status = stMultiLineComment;
                    tc.Skip(2);
                    this.ParseMultiLineComment(tc);
                }
                else if (tc.Char() == '/' && tc.NChar() == '/')
                {
                    tc.SkipRemainder();
                }
                else if (tc.Char() == '@' && tc.NChar() == '"')
                {
                    this.status = stVerbatimString;
                    tc.Skip(2);
                    this.ParseVerbatimString(tc);
                }
                else if (tc.Char() == '"' && tc.NChar() == '"' && tc.NNChar() == '"')
                {
                    this.status = stTripleQuotedString;
                    tc.Skip(3);
                    this.ParseTripleQuotedString(tc);
                }
                else if (tc.Char() == '"')
                {
                    this.status = stString;
                    tc.Next();
                    this.ParseString(tc);
                }
                else if (tc.Char() == '<' && tc.NChar() == '\'')
                {
                    // this is just a generic parameter, so skip it already
                    tc.Skip(2);
                }
                else if (Char.IsLetterOrDigit(tc.Char()) && tc.NChar() == '\'')
                {
                    // identifier like c'
                    tc.Skip(2);
                }
                else if (tc.Char() == '\'')
                {
                    this.status = stChar;
                    tc.Next();
                    this.ParseCharLiteral(tc);
                }
                else if (lang.BraceList.IndexOf(tc.Char()) >= 0)
                {
                    yield return(new CharPos(tc.Char(), tc.AbsolutePosition));

                    tc.Next();
                }
                else
                {
                    tc.Next();
                }
            }
        }