Ejemplo n.º 1
0
 private static string LexMultiLineComment(TransactableTokenStream stream)
 {
     var comment = string.Empty;
     while (stream.Current != null && stream.Current != "*" && stream.Peek(1) != "/")
     {
         comment += stream.Current;
         stream.Consume();
     }
     if (stream.Current == "*" && stream.Peek(1) == "/")
     {
         comment += stream.Current;
         stream.Consume();
         comment += stream.Current;
         stream.Consume();
     }
     return $"/*{comment}";
 }
Ejemplo n.º 2
0
        private static string LexSingleLineComment(TransactableTokenStream stream)
        {
            var comment = string.Empty;
            while (stream.Current != null && stream.Current != "\r" && stream.Peek(1) != "\n")
            {
                comment += stream.Current;
                stream.Consume();
            }

            return $"//{comment}";
        }