Ejemplo n.º 1
0
 public Location Union(Location other)
 {
     if (File != other.File)
         throw new InvalidOperationException("locations are from distinct files");
     if (StartPos <= other.StartPos)
     {
         if (EndPos >= other.EndPos)
             return this;
         else
             return new Location
                 (File, StartPos, StartLine, StartColumn, other.EndPos, other.EndLine, other.EndColumn);
     }
     else
     {
         if (EndPos >= other.EndPos)
             return new Location
                 (File, other.StartPos, other.StartLine, other.StartColumn, EndPos, EndLine, EndColumn);
         else
             return other;
     }
 }
Ejemplo n.º 2
0
 private void ConsumeCommentStatement(ISeq<Statement> statements)
 {
     if (pendingComments != null)
     {
         statements.Add(new CommentStatement(pendingCommentsLoc, pendingComments.ToString()));
         pendingComments = null;
         pendingCommentsLoc = null;
     }
 }
Ejemplo n.º 3
0
 // TODO: Invoke within statement parsers
 private Expression ConsumeCommentExpression(Expression e)
 {
     if (pendingComments != null)
     {
         e = new CommentExpression(pendingCommentsLoc, e, pendingComments.ToString());
         pendingComments = null;
         pendingCommentsLoc = null;
     }
     return e;
 }
Ejemplo n.º 4
0
 public Parser(Lexer lexer)
 {
     this.lexer = lexer;
     lookahead = new Seq<InputElement>();
     lastLineTerminator = null;
     pendingComments = null;
     pendingCommentsLoc = null;
 }
Ejemplo n.º 5
0
 public MessageContext(MessageContext parent, Location loc, Action<StringBuilder> append)
 {
     Parent = parent;
     Loc = loc;
     this.append = append;
 }
Ejemplo n.º 6
0
 public static MessageContext TraceFile(Location loc)
 {
     return new MessageContext(null, loc, sb => { });
 }
Ejemplo n.º 7
0
 public SyntaxException(Location loc, string context, string details)
 {
     Loc = loc;
     Context = context;
     Details = details;
 }
Ejemplo n.º 8
0
 public InputElement(Location loc, InputElementTag tag, string value)
 {
     Loc = loc;
     Tag = tag;
     Value = value;
 }