public virtual RakunNode readXML(string fileinput) { _rootNode = new RakunNode(); xml = new XmlDocument(); // XmlDocument 생성 xml.LoadXml(fileinput); xnList = xml.FirstChild; //접근할 노드 foreach (XmlNode xn in xnList) { _rootNode.readXML(xn); } foreach (XmlNode xn in xml.FirstChild) { if (_rootNode.setupfunction == null) { _rootNode.setupfunction = _rootNode.GetfindFunctionNode("setup", xn); } if (_rootNode.loopfunction == null) { _rootNode.loopfunction = _rootNode.GetfindFunctionNode("loop", xn); } if (_rootNode.IFTrueDeclear == null) { _rootNode.IFTrueDeclear = _rootNode.GetfindFunctionNode("if", xn); } if (_rootNode.IFFalseDeclear == null) { _rootNode.IFFalseDeclear = _rootNode.GetfindFunctionNode("else", xn); } } //ModuleName = System.IO.Path.GetFileNameWithoutExtension(fileinput); //GenRakunValue(); return(_rootNode); }
public virtual RakunNodeBase Append(RakunNodeBase c1original, RakunNodeBase c2original) { RakunNodeBase c2 = c2original.Clone() as RakunNodeBase; RakunNodeBase c1 = (RakunNodeBase)c1original.Clone(); if (c1._rootNode == null) { return(c2.Clone() as RakunNodeBase); } if (c2._rootNode == null) { return(c2.Clone() as RakunNodeBase); } if (c1._rootNode.setupfunction == c2._rootNode.setupfunction) { return(c2.Clone() as RakunNodeBase); } int value = c1.GenRakunValue(0); c2.GenRakunValue(value); foreach (RakunNode RNode in c2._rootNode.Rakunlist) { RakunNode.addFunctionDcelear(ref c1._rootNode.declaration_list, RNode.ValueDeclear, true, true); //break; } RakunNode.addFunctionDcelear(ref c1._rootNode.setupfunction, c2._rootNode.setupfunction); RakunNode.addFunctionDcelear(ref c1._rootNode.loopfunction, c2._rootNode.loopfunction); return(c1); }
public void CreateRNode(XmlNode node, XmlNode Upper) { int count = 0; string savedName = string.Empty; foreach (XmlNode xn in node) { if (xn.Attributes != null) { if (xn.Attributes["name"].Value == "node") { if (count < 2) { if (GetnodeName(xn) == "identifier") { count++; if (count == 2) { savedName = xn.InnerText; } } else if (GetnodeName(xn) == "symbol") { //Serial.begin() <-- 요러건거가 id 두개로 인식됨 count = 0; } } else if (GetnodeName(xn) == "paran_group") { count++; } else if (GetnodeName(xn) == "brace_group") { RakunNode _rnode = new RakunNode(); _rnode.NodeName = savedName.Trim(); _rnode.type = RakunType.FunctionName; //Rakunlist.Add(_rnode); count = 0; savedName = ""; } else if (xn.Attributes["name"].Value == "semicolon") { count = 0; savedName = ""; } else { RakunNode _rnode = new RakunNode(); _rnode.NodeName = savedName.Trim(); _rnode.type = RakunType.ValueName; _rnode.ValueDeclear = Upper; Rakunlist.Add(_rnode); count = 0; savedName = ""; } } } } if (count == 2) { RakunNode _rnode = new RakunNode(); _rnode.NodeName = savedName.Trim(); _rnode.type = RakunType.ValueName; Rakunlist.Add(_rnode); count = 0; savedName = ""; } }