Beispiel #1
0
        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);
        }
Beispiel #2
0
 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)
 {
 }
Beispiel #4
0
 public SemanticException(HappySourceLocation happySourceLocation, string fmt, params object[] args)
     : base(happySourceLocation, fmt, args)
 {
 }
Beispiel #5
0
 public SourceException(HappySourceLocation loc, string msg, params object[] args)
     : this(loc, Util.Format(msg, args))
 {
 }
Beispiel #6
0
 public SourceException(HappySourceLocation loc, Enum key, string msg)
     : this(loc, msg)
 {
     _key = key;
 }
Beispiel #7
0
 public SourceException(Exception inner, HappySourceLocation loc, string msg)
     : base(Util.Format("{0}: {1}", loc, msg), inner)
 {
     _location = loc;
 }
Beispiel #8
0
 public EofException(HappySourceLocation loc)
     : base(loc)
 {
 }
Beispiel #9
0
 public void DefaultValueMayOnlyBeSpecifiedOnce(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.DefaultValueMayOnlyBeSpecifiedOnce);
 }
Beispiel #10
0
 public void DefaultCaseSpecifiedMoreThanOnce(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.DefaultCaseSpecifiedMoreThanOnce);
 }
Beispiel #11
0
 public void ContinueNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.ContinueNotAllowedHere);
 }
Beispiel #12
0
 public void CannotNestTemplatesWithinTemplateOutputExpression(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.CannotNestTemplatesWithinTemplateOutputExpression);
 }
Beispiel #13
0
 public void BreakNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.BreakNotAllowedHere);
 }
Beispiel #14
0
 public void BetweenMayOnlyAppearOnceInFor(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.BetweenMayOnlyAppearOnceInFor);
 }
Beispiel #15
0
        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)
 {
 }
Beispiel #18
0
 public void EndTemplateStatementBlockNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.EndTemplateStatementBlockNotAllowedHere);
 }
Beispiel #19
0
 public SourceException(HappySourceLocation loc)
 {
     _location = loc;
 }
Beispiel #20
0
 public void ExpectedOperator(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.ExpectedOperator);
 }
Beispiel #21
0
 public SourceException(HappySourceLocation loc, Enum key)
     : this(loc)
 {
     _key = key;
 }
Beispiel #22
0
        bool EatNextTokenIf(HappyTokenKind tokenKind, out HappySourceLocation location)
        {
            if (_lexer.PeekToken().HappyTokenKind == tokenKind)
            {
                location = _lexer.NextToken().Location;
                return true;
            }

            location = HappySourceLocation.None;
            return false;
        }
Beispiel #23
0
 public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg)
     : this(inner, loc, msg)
 {
     _key = key;
 }
Beispiel #24
0
        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()));
        }
Beispiel #25
0
 public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg, params object[] args)
     : this(inner, loc, key, Util.Format(msg, args))
 {
 }
Beispiel #26
0
        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)
 {
 }
Beispiel #28
0
 public AbortParseException(HappySourceLocation loc)
     : base(loc)
 {
 }
Beispiel #29
0
 internal Token(HappySourceLocation loc, HappyTokenKind happyTokenKind, string text)
 {
     this.HappyTokenKind = happyTokenKind;
     this.Location = loc;
     this.Text = text;
 }
Beispiel #30
0
 public void WhereMayOnlyAppearOnceInFor(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.WhereMayOnlyAppaearOnceInFor);
 }