예제 #1
0
        public void visit(SFNode field)
        {
            VRML97Token token = context.PeekNextToken();

            switch (token.Text)
            {
            case "NULL":
                field.Node = null;
                break;

            default:
                context.PushNodeContainer(field);
                nodeStatementParser(context);
                context.PopNodeContainer();
                break;
            }
        }
예제 #2
0
        public void Parse(MFNode container) {
            var context = new ParserContext(_tokenizer);
            try {
                _fieldParser = new FieldParser(context, ParseNodeStatement);

                context.PushNodeContainer(container);

                ParseStatements(context);

                context.PopNodeContainer();

            } catch (VrmlParseException exc) {
                throw new InvalidVRMLSyntaxException(exc.Message + " at Line: " + context.LineIndex + " Column: " + context.ColumnIndex);
            }
        }
예제 #3
0
        public void Parse(MFNode container)
        {
            var context = new ParserContext(_tokenizer);

            try {
                _fieldParser = new FieldParser(context, ParseNodeStatement);

                context.PushNodeContainer(container);

                ParseStatements(context);

                context.PopNodeContainer();
            } catch (VrmlParseException exc) {
                throw new InvalidVRMLSyntaxException(exc.Message + " at Line: " + context.LineIndex + " Column: " + context.ColumnIndex);
            }
        }
예제 #4
0
        protected virtual void ParseProto(ParserContext context)
        {
            context.ReadKeyword("PROTO");

            var proto = new ProtoNode {
                name = ParseNodeNameId(context)
            };

            context.PushNodeContainer(proto.children);
            context.PushFieldContainer(proto);
            ParseInterfaceDeclarations(context);
            if (context.ReadNextToken().Type != VRML97TokenType.OpenBrace)
            {
                throw new InvalidVRMLSyntaxException();
            }
            ParseProtoBody(context);
            if (context.ReadNextToken().Type != VRML97TokenType.CloseBrace)
            {
                throw new InvalidVRMLSyntaxException();
            }
            context.PopFieldContainer();
            context.PopNodeContainer();
            context.RegisterPtototype(proto);
        }
예제 #5
0
        protected virtual void ParseProto(ParserContext context) {
            context.ReadKeyword("PROTO");

            var proto = new ProtoNode {
                name = ParseNodeNameId(context)
            };
            context.PushNodeContainer(proto.children);
            context.PushFieldContainer(proto);
            ParseInterfaceDeclarations(context);
            if (context.ReadNextToken().Type != VRML97TokenType.OpenBrace) {
                throw new InvalidVRMLSyntaxException();
            }
            ParseProtoBody(context);
            if (context.ReadNextToken().Type != VRML97TokenType.CloseBrace) {
                throw new InvalidVRMLSyntaxException();
            }
            context.PopFieldContainer();
            context.PopNodeContainer();
            context.RegisterPtototype(proto);
        }