public void TestAllowGenericChildNodes() { var elem = new Record(); elem.AddChild("generic-tag").AddText("Content").SetOption("tag", true); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Record>" + Environment.NewLine + " <generic-tag tag=\"True\">Content</generic-tag>" + Environment.NewLine + "</Record>", elem.ToString() ); }
public Record recordDef() { EnterRule_recordDef(); EnterRule("recordDef", 5); TraceIn("recordDef", 5); Record rec = default(Record); IToken identifier8 = default(IToken); List<Variable> recordVariableList9 = default(List<Variable>); rec = new Record(); try { DebugEnterRule(GrammarFileName, "recordDef"); DebugLocation(87, 5); try { // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:92:6: ( TYPE identifier EQUAL RECORD recordVariableList END SEMI ) DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:92:8: TYPE identifier EQUAL RECORD recordVariableList END SEMI { DebugLocation(92, 8); Match(input,TYPE,Follow._TYPE_in_recordDef308); DebugLocation(92, 13); PushFollow(Follow._identifier_in_recordDef310); identifier8=identifier(); PopFollow(); DebugLocation(92, 24); rec.SetName(identifier8); DebugLocation(92, 58); Match(input,EQUAL,Follow._EQUAL_in_recordDef314); DebugLocation(92, 64); Match(input,RECORD,Follow._RECORD_in_recordDef316); DebugLocation(93, 7); PushFollow(Follow._recordVariableList_in_recordDef324); recordVariableList9=recordVariableList(); PopFollow(); DebugLocation(94, 7); foreach(var child in recordVariableList9) { rec.AddChild(child); } DebugLocation(100, 7); Match(input,END,Follow._END_in_recordDef340); DebugLocation(100, 11); Match(input,SEMI,Follow._SEMI_in_recordDef342); } } catch (RecognitionException e) { throw e; } finally { TraceOut("recordDef", 5); LeaveRule("recordDef", 5); LeaveRule_recordDef(); } DebugLocation(101, 5); } finally { DebugExitRule(GrammarFileName, "recordDef"); } return rec; }