Exemplo n.º 1
0
 LangElement CreateIncDec(Span span, LangElement variable, bool inc, bool post)
 {
     if (variable is VariableUse)
     {
         return(_astFactory.IncrementDecrement(span, variable, inc, post));
     }
     _errors.Error(variable.Span, FatalErrors.CheckVarUseFault);
     return(variable);
 }
 public virtual void Error(IToken tok, string msg)
 {
     Contract.Requires(msg != null);
     Contract.Requires(tok != null);
     errors++;
     if (errorSink == null)
     {
         ConsoleColor col = Console.ForegroundColor;
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("{0}({1},{2}): Error: {3}",
                           tok.filename, tok.line, tok.col - 1,
                           msg);
         Console.ForegroundColor = col;
     }
     else
     {
         errorSink.Error(tok, msg);
     }
 }
Exemplo n.º 3
0
 void ITokenProvider <SemanticValueType, Span> .ReportError(string[] expectedTerminals)
 {
     // TODO (expected tokens....)
     _errors.Error(_tokenPosition, FatalErrors.SyntaxError, string.Format(Strings.unexpected_token, GetTokenString()));
 }