private void ReadText() { int npos = 0; // CCLOG("read Text!"); string str = StringUtil.NextStringStopUntil(_line, "[\n", _pos, out npos); //auto str = nextString("[\n", &npos); //if (str) //{ if (_pos < npos) { // KAGWord tag0 = new KAGWord(KAGWord.Type.TEXT, "op", "print"); KAGWord tag1 = new KAGWord(KAGWord.Type.TEXT, "text", str); // _words.Add(tag0); _words.Add(tag1); } //} _pos = npos; ChangeReadMode(Mode.TAG); }
private void ReadTag() { int npos = 0; string op = NextString(" ]", out npos); //if there is a tag if (op != "") { KAGWord tag = new KAGWord(KAGWord.Type.TAG, "op", op); _words.Add(tag); } ChangeReadMode(Mode.ATTRIBUTE); }
private void ReadName() { int npos = 0; KAGWord tag1; if (_line == "#") //No Name { tag1 = new KAGWord(KAGWord.Type.NAME, "text", ""); } else { string str = StringUtil.NextStringStopUntil(_line, "[\n", _pos+1, out npos); tag1 = new KAGWord(KAGWord.Type.NAME, "text", str); } _words.Add(tag1); }
private void ReadScenario() { int npos = 0; //auto str = StringUtil::nextStringStopUntil(_line, '[', _pos, &npos); string str = NextString("[\n", out npos); KAGWord op = new KAGWord(KAGWord.Type.SCENARIO, "op", "scenario"); KAGWord tag = new KAGWord(KAGWord.Type.SCENARIO, "scenario", str); _words.Add(op); _words.Add(tag); }
private void ReadAttribute() { // CCLOG("read attribute"); int npos = 0; string op = NextString(" =", out npos); //if (op) IgnoreBlanks(); if (_line[_pos] == '=') { ++_pos; IgnoreBlanks(); string value = NextString(" ]", out npos); // auto value = StringUtil::nextStringStopUntil(_line, " ]", _pos, &npos); // _pos = npos; KAGWord attr = new KAGWord(KAGWord.Type.ATTRIBUTE, op, value); _words.Add(attr); } else { Debug.LogFormat("read attribute wrong! op = {0}", op); } }