コード例 #1
0
        public override void ExitPair([NotNull] PairContext context)
        {
            var fullpath = path.GetPath();

            path.Pop();
            logger.Trace("Exit pair {0}", fullpath);

            Models.IModelObject pair = null;
            if (context.pairvalue()?.value() != null)
            {
                pair = ValueProps.Get(context.pairvalue().value());
            }
            if (pair == null)
            {
                var value = new List <Models.IModelObject>();
                pair = new Models.ModelCompositeObject
                {
                    Value = value
                };
            }
            pair.Name = context.ID().GetText();

            pair.Path = fullpath;

            PairProps.Put(context, pair);
            if (context.pairvalue()?.inherits() != null)
            {
                pair.Inherits     = true;
                pair.InheritsFrom = context.pairvalue().inherits().ID().GetText();
            }
            if (context.modifier != null)
            {
                pair.Modified = true;
                pair.Modifier = context.modifier.Text;
            }
            GraphElements.Add(pair.Path, new GraphElement(pair.Path, pair));

            logger.Trace("Pair: {0}{1} = {2}{3}", pair.Modifier, pair.Name, pair.GetText() ?? "unknown", context.pairvalue()?.inherits() != null ? " : " + pair.InheritsFrom : "");

            base.ExitPair(context);
        }
コード例 #2
0
ファイル: nmlParser.cs プロジェクト: nml-lang/parser
    public PairContext pair()
    {
        PairContext _localctx = new PairContext(Context, State);

        EnterRule(_localctx, 6, RULE_pair);
        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 33; Match(KEY);
                State = 34; value();
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
コード例 #3
0
        public PairContext pair()
        {
            PairContext _localctx = new PairContext(Context, State);

            EnterRule(_localctx, 4, RULE_pair);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 26; Match(LPAREN);
                    State = 28;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    do
                    {
                        {
                            {
                                State = 27; item();
                            }
                        }
                        State = 30;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                    } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << NUMBER) | (1L << STRING) | (1L << SYMBOL) | (1L << LPAREN))) != 0));
                    State = 32; Match(DOT);
                    State = 33; Match(RPAREN);
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
コード例 #4
0
ファイル: JSONParser.cs プロジェクト: mpmedia/Excess
	public PairContext pair() {
		PairContext _localctx = new PairContext(Context, State);
		EnterRule(_localctx, 4, RULE_pair);
		int _la;
		try {
			EnterOuterAlt(_localctx, 1);
			{
			State = 75;
			_la = TokenStream.La(1);
			if ( !(_la==Identifier || _la==StringLiteral) ) {
			ErrorHandler.RecoverInline(this);
			}
			else {
			    Consume();
			}
			State = 76; Match(Colon);
			State = 77; value();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
コード例 #5
0
 public override void EnterPair([NotNull] PairContext context)
 {
     base.EnterPair(context);
     logger.Trace("Enter pair {0}", context.ID().GetText());
     path.Push(context.ID().GetText());
 }