示例#1
0
        protected virtual void ParseURLList(ParserContext context)
        {
            MFString urls = new MFString();

            urls.AcceptVisitor(_fieldParser);
            //TODO: Process Urls.
        }
示例#2
0
 public void visit(MFString field)
 {
     field.clearValues();
     ParseMField(subcontext => {
         var child = new SFString();
         visit(child);
         field.AppendValue(child);
     });
 }
示例#3
0
        public override Field Clone()
        {
            var clone = new MFString();

            foreach (var child in Values)
            {
                clone.AppendValue((SFString)child.Clone());
            }
            return(clone);
        }
示例#4
0
        public void FromString()
        {
            var obj = new MFString();

            obj.FromString("\"Hi Alex, how are you?\" \"It's a beautiful day, isn't it?\" \"Web3D is a awesome technology.\"");

            Assert.IsTrue(obj.Count == 3);
            Assert.IsTrue(obj[0].Equals(new SFString("Hi Alex, how are you?")));
            Assert.IsTrue(obj[1].Equals(new SFString("It's a beautiful day, isn't it?")));
            Assert.IsTrue(obj[2].Equals(new SFString("Web3D is a awesome technology.")));
        }
        public static MFString MFString(string @string)
        {
            string tmp = removeQuotes(@string);

            if (tmp.StartsWith(DATA_TEXT_PLAIN))
            {
                //TODO: complete implementation of data:uri as seen in https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
                return(new List <string> {
                    tmp
                });
            }

            if (!(@string.TrimStart().StartsWith("\"") || @string.TrimStart().StartsWith("'")))
            {
                @string = "'" + @string;
            }
            if (!(@string.TrimEnd().EndsWith("\"") || @string.TrimEnd().EndsWith("'")))
            {
                @string = @string + "'";
            }

            List <string>   lst = new MFString();
            Regex           r;
            MatchCollection m;

            // Single and double quote parenthesis extraction
            // Order is important in MFString sequences.
            r = new Regex("(\"([^\"]+)\"|'([^']+)')\\s?",
                          //RegexOptions.IgnorePatternWhitespace |
                          RegexOptions.Multiline | RegexOptions.ExplicitCapture);
            m = r.Matches(@string);
            if (m.Count > 0)
            {
                foreach (Match mm in m)
                {
                    for (int i = 0; i < mm.Groups.Count; i++)
                    {
                        String string1 = mm.Groups[i].ToString();

                        lst.Add(removeQuotes(string1));

                        break; // just do first group
                    }
                }
            }

            return(lst);
        }
示例#6
0
        X3DFieldBase ParseUntypedFieldValueArray()
        {
            char ts = GetNextTerminalSymbolToken();           // [

            object token = PeekNextToken();

            X3DFieldBase ret = null;

            VRMLTokenIdKeywordOrFieldType idToken = token as VRMLTokenIdKeywordOrFieldType;

            if (idToken != null)
            {
                ret = new MFNode(ParseUntypedFieldValueNodeArray());
            }

            VRMLTokenString strToken = token as VRMLTokenString;

            if (strToken != null)
            {
                ret = new MFString(ParseUntypedFieldValueStringArray());
            }

            VRMLTokenNumber numberToken = token as VRMLTokenNumber;

            if (numberToken != null)
            {
                ret = new MFNumbers(ParseUntypedFieldValueNumbers());
            }

            ts = GetNextTerminalSymbolToken();
            if (ts != ']')
            {
                ErrorParsingToken("]", ts.ToString(), "unknown type value (array)");
            }

            if (ret == null)
            {
                ret = new MFEmpty();
            }
            return(ret);
        }
示例#7
0
 public void Visit(MFString field)
 {
     throw new NotImplementedException();
 }
示例#8
0
        protected virtual void ParseURLList(ParserContext context)
        {
            MFString urls = new MFString();

            urls.AcceptVisitor(m_fieldParser);
        }
示例#9
0
 protected virtual void ParseURLList(ParserContext context) {
     MFString urls = new MFString();
     urls.AcceptVisitor(_fieldParser);
     //TODO: Process Urls.
 }
示例#10
0
 public void visit(MFString field) {
     throw new NotImplementedException();
 }
示例#11
0
 public void visit(MFString field) {
     field.clearValues();
     ParseMField(subcontext => {
         var child = new SFString();
         visit(child);
         field.AppendValue(child);
     });
 }