/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ /* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "avmplus.h" #ifdef VMCFG_EVAL #include "eval.h" namespace avmplus { namespace RTC { Token Lexer::xmlAtomImpl() { mark=idx; switch (idx[0]) { case 0: compiler->syntaxError(lineno, SYNTAXERR_XML_EOI_IN_MARKUP); case '<': switch (idx[1]) { case '!': if (idx[2] == '[' && idx[3] == 'C' && idx[4] == 'D' && idx[5] == 'A' && idx[6] == 'T' && idx[7] == 'A' && idx[8] == '[') { idx += 9; return xmlMarkup(T_XmlCDATA); } if (idx[2] == '-' && idx[3] == '-') { idx += 4; return xmlMarkup(T_XmlComment); } compiler->syntaxError(lineno, SYNTAXERR_XML_INVALID_LEFTBANG); case '?': idx += 2; return xmlMarkup(T_XmlProcessingInstruction); case '/': idx += 2; return T_XmlLeftAngleSlash; default: idx += 1; return T_XmlLeftAngle; } case '/': if (idx[1] == '>') { idx += 2; return T_XmlSlashRightAngle; } compiler->syntaxError(lineno, SYNTAXERR_XML_INVALID_SLASH); case '>': idx += 1; return T_XmlRightAngle; case '{': idx += 1; return T_XmlLeftBrace; case '}': idx += 1; return T_XmlRightBrace; case '=': idx += 1; return T_XmlEquals; case ' ': case '\t': case '\r': case '\n': return xmlWhitespace(); case '"': case '\'': return xmlString(); default: if (isXmlNameStart(idx[0])) return xmlName(); else return xmlText(); } } // Capture everything from the starting through the ending punctuation. Token Lexer::xmlMarkup(Token token) { uint32_t l = lineno; switch (token) { case T_XmlComment: mark = idx-4; // "