Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 internal void UnexpectedEndOfInputInComment(HappySourceLocation loc)
 {
     this.Add(loc, ErrorCode.UnexpectedEndOfInputInComment);
 }
Ejemplo n.º 3
0
 public InternalSourceException(Exception inner, HappySourceLocation loc, string msg, params object[] args)
     : base(inner, loc, msg, args)
 {
 }
Ejemplo n.º 4
0
 public SemanticException(HappySourceLocation happySourceLocation, string fmt, params object[] args)
     : base(happySourceLocation, fmt, args)
 {
 }
Ejemplo n.º 5
0
 public SourceException(HappySourceLocation loc, string msg, params object[] args)
     : this(loc, Util.Format(msg, args))
 {
 }
Ejemplo n.º 6
0
 public SourceException(HappySourceLocation loc, Enum key, string msg)
     : this(loc, msg)
 {
     _key = key;
 }
Ejemplo n.º 7
0
 public SourceException(Exception inner, HappySourceLocation loc, string msg)
     : base(Util.Format("{0}: {1}", loc, msg), inner)
 {
     _location = loc;
 }
Ejemplo n.º 8
0
 public EofException(HappySourceLocation loc)
     : base(loc)
 {
 }
Ejemplo n.º 9
0
 public void DefaultValueMayOnlyBeSpecifiedOnce(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.DefaultValueMayOnlyBeSpecifiedOnce);
 }
Ejemplo n.º 10
0
 public void DefaultCaseSpecifiedMoreThanOnce(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.DefaultCaseSpecifiedMoreThanOnce);
 }
Ejemplo n.º 11
0
 public void ContinueNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.ContinueNotAllowedHere);
 }
Ejemplo n.º 12
0
 public void CannotNestTemplatesWithinTemplateOutputExpression(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.CannotNestTemplatesWithinTemplateOutputExpression);
 }
Ejemplo n.º 13
0
 public void BreakNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.BreakNotAllowedHere);
 }
Ejemplo n.º 14
0
 public void BetweenMayOnlyAppearOnceInFor(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.BetweenMayOnlyAppearOnceInFor);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 16
0
 public UnhandledCaseSourceException(HappySourceLocation loc)
     : base(loc)
 {
 }
Ejemplo n.º 17
0
 public UnhandledCaseSourceException(HappySourceLocation loc, string msg)
     : base(loc, msg)
 {
 }
Ejemplo n.º 18
0
 public void EndTemplateStatementBlockNotAllowedHere(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.EndTemplateStatementBlockNotAllowedHere);
 }
Ejemplo n.º 19
0
 public SourceException(HappySourceLocation loc)
 {
     _location = loc;
 }
Ejemplo n.º 20
0
 public void ExpectedOperator(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.ExpectedOperator);
 }
Ejemplo n.º 21
0
 public SourceException(HappySourceLocation loc, Enum key)
     : this(loc)
 {
     _key = key;
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 23
0
 public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg)
     : this(inner, loc, msg)
 {
     _key = key;
 }
Ejemplo n.º 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()));
        }
Ejemplo n.º 25
0
 public SourceException(Exception inner, HappySourceLocation loc, Enum key, string msg, params object[] args)
     : this(inner, loc, key, Util.Format(msg, args))
 {
 }
Ejemplo n.º 26
0
        public void FailIfEof(HappySourceLocation startingLocation)
        {
            if (_reader.Eof)
            {
                foreach (Token t in _readAhead)
                    if (t.HappyTokenKind != HappyTokenKind.EndOfInput)
                        return;

                _errorCollector.UnexpectedEndOfInputWhileParsingSection(startingLocation);
            }
        }
Ejemplo n.º 27
0
 public InternalSourceException(HappySourceLocation loc)
     : base(loc)
 {
 }
Ejemplo n.º 28
0
 public AbortParseException(HappySourceLocation loc)
     : base(loc)
 {
 }
Ejemplo n.º 29
0
 internal Token(HappySourceLocation loc, HappyTokenKind happyTokenKind, string text)
 {
     this.HappyTokenKind = happyTokenKind;
     this.Location = loc;
     this.Text = text;
 }
Ejemplo n.º 30
0
 public void WhereMayOnlyAppearOnceInFor(HappySourceLocation location)
 {
     this.Add(location, ErrorCode.WhereMayOnlyAppaearOnceInFor);
 }