public static HappySourceLocation Merge(HappySourceLocation start, HappySourceLocation end) { if(start == Invalid || end == Invalid) return Invalid; if (start == None || end == None) return None; DebugAssert.AreSameObject(start.Unit, end.Unit, "Start and end SourceUnits don't match."); return new HappySourceLocation(start.Unit, start.Span.Start, end.Span.End); }
internal void UnexpectedEndOfInputInComment(HappySourceLocation loc) { this.Add(loc, ErrorCode.UnexpectedEndOfInputInComment); }
public InternalSourceException(Exception inner, HappySourceLocation loc, string msg, params object[] args) : base(inner, loc, msg, args) { }
public SemanticException(HappySourceLocation happySourceLocation, string fmt, params object[] args) : base(happySourceLocation, fmt, args) { }
public SourceException(HappySourceLocation loc, string msg, params object[] args) : this(loc, Util.Format(msg, args)) { }
public SourceException(HappySourceLocation loc, Enum key, string msg) : this(loc, msg) { _key = key; }
public SourceException(Exception inner, HappySourceLocation loc, string msg) : base(Util.Format("{0}: {1}", loc, msg), inner) { _location = loc; }
public EofException(HappySourceLocation loc) : base(loc) { }
public void DefaultValueMayOnlyBeSpecifiedOnce(HappySourceLocation location) { this.Add(location, ErrorCode.DefaultValueMayOnlyBeSpecifiedOnce); }
public void DefaultCaseSpecifiedMoreThanOnce(HappySourceLocation location) { this.Add(location, ErrorCode.DefaultCaseSpecifiedMoreThanOnce); }
public void ContinueNotAllowedHere(HappySourceLocation location) { this.Add(location, ErrorCode.ContinueNotAllowedHere); }
public void CannotNestTemplatesWithinTemplateOutputExpression(HappySourceLocation location) { this.Add(location, ErrorCode.CannotNestTemplatesWithinTemplateOutputExpression); }
public void BreakNotAllowedHere(HappySourceLocation location) { this.Add(location, ErrorCode.BreakNotAllowedHere); }
public void BetweenMayOnlyAppearOnceInFor(HappySourceLocation location) { this.Add(location, ErrorCode.BetweenMayOnlyAppearOnceInFor); }
void Add(HappySourceLocation loc, Enum message, params object[] args) { string messageName = message.ToString(); string msgfmt = Resources.CompileErrorMessages.ResourceManager.GetString(messageName); DebugAssert.IsNotNull(msgfmt, "Error message \"{0}\" not found in resources", messageName.ToString()); _sourceErrors.Add(loc.Unit, Util.Format(msgfmt, args), loc.Span, message.GetHashCode(), Severity.FatalError); }
public UnhandledCaseSourceException(HappySourceLocation loc) : base(loc) { }
public UnhandledCaseSourceException(HappySourceLocation loc, string msg) : base(loc, msg) { }
public void EndTemplateStatementBlockNotAllowedHere(HappySourceLocation location) { this.Add(location, ErrorCode.EndTemplateStatementBlockNotAllowedHere); }
public SourceException(HappySourceLocation loc) { _location = loc; }
public void ExpectedOperator(HappySourceLocation location) { this.Add(location, ErrorCode.ExpectedOperator); }
public SourceException(HappySourceLocation loc, Enum key) : this(loc) { _key = key; }
bool EatNextTokenIf(HappyTokenKind tokenKind, out HappySourceLocation location) { if (_lexer.PeekToken().HappyTokenKind == tokenKind) { location = _lexer.NextToken().Location; return true; } location = HappySourceLocation.None; return false; }
public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg) : this(inner, loc, msg) { _key = key; }
AnonymousTemplate ParseAnonymousTemplateExpression(HappySourceLocation startsAt) { List<AstNodeBase> sections = new List<AstNodeBase>(); //the <| already parsed during call to ParseExpression() //SourceLocation sectionStartsAt = Expect(_tokenKind.OpenBrace, "{").location; bool keepParsing = true; HappySourceLocation endingLocation = HappySourceLocation.Invalid; while(keepParsing) { sections.Add(this.ParseStatement()); if (this.EatNextTokenIf(HappyTokenKind.EndTemplate, out endingLocation)) keepParsing = false; } return new AnonymousTemplate(new StatementBlock(startsAt, endingLocation, sections.ToArray())); }
public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg, params object[] args) : this(inner, loc, key, Util.Format(msg, args)) { }
public void FailIfEof(HappySourceLocation startingLocation) { if (_reader.Eof) { foreach (Token t in _readAhead) if (t.HappyTokenKind != HappyTokenKind.EndOfInput) return; _errorCollector.UnexpectedEndOfInputWhileParsingSection(startingLocation); } }
public InternalSourceException(HappySourceLocation loc) : base(loc) { }
public AbortParseException(HappySourceLocation loc) : base(loc) { }
internal Token(HappySourceLocation loc, HappyTokenKind happyTokenKind, string text) { this.HappyTokenKind = happyTokenKind; this.Location = loc; this.Text = text; }
public void WhereMayOnlyAppearOnceInFor(HappySourceLocation location) { this.Add(location, ErrorCode.WhereMayOnlyAppaearOnceInFor); }