Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<Chunk> ParseChunkList()
- {
- List<Chunk> chunks = new List<Chunk>();
- if (!lex.AtBeginning && !lex.IsAt('{') && !lex.IsAt('}', -1))
- {
- throw new Exception("precondition");
- }
- while (!lex.AtEnd)
- {
- Chunk next;
- if (lex.IsAt('{'))
- {
- lex.Eat();
- lex.EatWhitespace();
- }
- if (lex.IsMatch(OPEN_FORMAT) || lex.IsMatch(OPEN_SCRIPT))
- {
- next = ParseTaggedChunk();
- }
- else
- {
- next = ParseTextChunk();
- }
- if (next == null) throw new Exception();
- chunks.Add(next);
- if (lex.IsAt('}'))
- {
- lex.Eat();
- break;
- }
- }
- if (!lex.IsAt(CLOSE_CURL, -1) && !lex.AtEnd)
- {
- throw new Exception("postcondition");
- }
- return chunks;
- }
Add Comment
Please, Sign In to add comment