reorganize file structure and use labjs for loading
This commit is contained in:
parent
40fa64995d
commit
72b556efaa
23 changed files with 632 additions and 56 deletions
96
src/XML.js
Normal file
96
src/XML.js
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
(function() {
|
||||
|
||||
window.XML = {};
|
||||
|
||||
// regexp must not have capturing parentheses
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
XML.RULES = {
|
||||
start :
|
||||
[
|
||||
{
|
||||
token: "text",
|
||||
regex: "<\\!\\[CDATA\\[",
|
||||
next: "cdata"
|
||||
},
|
||||
{
|
||||
token: "xml_pe",
|
||||
regex: "<\\?.*?\\?>"
|
||||
},
|
||||
{
|
||||
token: "comment",
|
||||
regex: "<\\!--",
|
||||
next: "comment"
|
||||
},
|
||||
{
|
||||
token: "text", // opening tag
|
||||
regex: "<",
|
||||
next: "tag"
|
||||
},
|
||||
{
|
||||
token: "text",
|
||||
regex: "\\s+"
|
||||
},
|
||||
{
|
||||
token: "text",
|
||||
regex: ".+"
|
||||
}
|
||||
],
|
||||
|
||||
tag:
|
||||
[
|
||||
{
|
||||
token: "text",
|
||||
regex: ">",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
token: "keyword",
|
||||
regex: "[-_a-zA-Z0-9:]+"
|
||||
},
|
||||
{
|
||||
token: "text",
|
||||
regex: "\\s+"
|
||||
},
|
||||
{
|
||||
token: "string",
|
||||
regex: '".*?"'
|
||||
},
|
||||
{
|
||||
token: "string",
|
||||
regex: "'.*?'"
|
||||
}
|
||||
],
|
||||
|
||||
cdata:
|
||||
[
|
||||
{
|
||||
token: "text",
|
||||
regex: "\\]\\]>",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
token: "text",
|
||||
regex: "\\s+"
|
||||
},
|
||||
{
|
||||
token: "text",
|
||||
regex: ".+"
|
||||
}
|
||||
],
|
||||
|
||||
comment:
|
||||
[
|
||||
{
|
||||
token: "comment",
|
||||
regex: ".*?-->",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
token: "comment",
|
||||
regex: ".+"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue