Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ProcessingInstructionAction.cs
Go to the documentation of this file.
2
4
6{
7 private Avt _nameAvt;
8
9 private string _name;
10
12 {
13 }
14
15 internal override void Compile(Compiler compiler)
16 {
20 {
21 _name = _nameAvt.Evaluate(null, null);
22 _nameAvt = null;
24 {
25 _name = null;
26 }
27 }
28 if (compiler.Recurse())
29 {
31 compiler.ToParent();
32 }
33 }
34
35 internal override bool CompileAttribute(Compiler compiler)
36 {
37 string localName = compiler.Input.LocalName;
38 string value = compiler.Input.Value;
39 if (Ref.Equal(localName, compiler.Atoms.Name))
40 {
42 return true;
43 }
44 return false;
45 }
46
47 internal override void Execute(Processor processor, ActionFrame frame)
48 {
49 switch (frame.State)
50 {
51 case 0:
52 if (_nameAvt == null)
53 {
55 if (_name == null)
56 {
57 frame.Finished();
58 break;
59 }
60 }
61 else
62 {
65 {
66 frame.Finished();
67 break;
68 }
69 }
70 goto case 3;
71 case 3:
72 if (!processor.BeginEvent(XPathNodeType.ProcessingInstruction, string.Empty, frame.StoredOutput, string.Empty, empty: false))
73 {
74 frame.State = 3;
75 break;
76 }
77 processor.PushActionFrame(frame);
78 frame.State = 1;
79 break;
80 case 1:
81 if (!processor.EndEvent(XPathNodeType.ProcessingInstruction))
82 {
83 frame.State = 1;
84 }
85 else
86 {
87 frame.Finished();
88 }
89 break;
90 default:
91 frame.Finished();
92 break;
93 }
94 }
95
96 internal static bool IsProcessingInstructionName(string name)
97 {
98 if (name == null)
99 {
100 return false;
101 }
102 int length = name.Length;
103 int i;
104 for (i = 0; i < length && XmlCharType.IsWhiteSpace(name[i]); i++)
105 {
106 }
107 if (i >= length)
108 {
109 return false;
110 }
111 int num = ValidateNames.ParseNCName(name, i);
112 if (num == 0)
113 {
114 return false;
115 }
116 for (i += num; i < length && XmlCharType.IsWhiteSpace(name[i]); i++)
117 {
118 }
119 if (i < length)
120 {
121 return false;
122 }
123 if (length == 3 && (name[0] == 'X' || name[0] == 'x') && (name[1] == 'M' || name[1] == 'm') && (name[2] == 'L' || name[2] == 'l'))
124 {
125 return false;
126 }
127 return true;
128 }
129}
static bool Equal(string strA, string strB)
Definition Ref.cs:5
static int ParseNCName(string s, int offset)
static bool IsWhiteSpace(char ch)
string Evaluate(Processor processor, ActionFrame frame)
Definition Avt.cs:37
static Avt CompileAvt(Compiler compiler, string avtText)
Definition Avt.cs:52
void CompileAttributes(Compiler compiler)
void CheckRequiredAttribute(Compiler compiler, object attrValue, string attrName)
override void Execute(Processor processor, ActionFrame frame)