10 #include "Teuchos_XML.hpp"
15 Language make_language() {
19 prods[PROD_DOC](
"document") >>
"toplevels";
20 prods[PROD_TOPLEVEL](
"toplevels") >>
"toplevel";
21 prods[PROD_TOPLEVELS](
"toplevels") >>
"toplevel",
"toplevels";
22 prods[PROD_TOPLEVELS_MISC](
"toplevels") >>
"toplevel",
"Misc",
"toplevels";
23 prods[PROD_TOPLEVEL_ELEMENT](
"toplevel") >>
"element";
24 prods[PROD_TOPLEVEL_XMLDECL](
"toplevel") >>
"XMLDecl";
25 prods[PROD_ELEMENT_EMPTY](
"element") >>
"EmptyElemTag";
26 prods[PROD_ELEMENT](
"element") >>
"STag",
"content";
27 prods[PROD_XMLDECL](
"XMLDecl") >>
"<",
"?",
"Name",
"TagFill",
"?",
">";
28 prods[PROD_STAG](
"STag") >>
"<",
"Name",
"TagFill",
">";
29 prods[PROD_ETAG](
"ETag") >>
"<",
"/",
"Name",
"S?",
">";
30 prods[PROD_EMPTY_TAG](
"EmptyElemTag") >>
"<",
"Name",
"TagFill",
"/",
">";
31 prods[PROD_CONTENT](
"content") >>
"CharData?",
"ContentItem*",
"ETag";
32 prods[PROD_NO_CONTENT_ITEMS](
"ContentItem*");
33 prods[PROD_CONTENT_ITEMS](
"ContentItem*") >>
"ContentItem*",
"ContentItem",
"CharData?";
34 prods[PROD_CONTENT_ELEMENT](
"ContentItem") >>
"element";
35 prods[PROD_CONTENT_REF](
"ContentItem") >>
"Reference";
36 prods[PROD_CONTENT_COMMENT](
"ContentItem") >>
"Comment";
37 prods[PROD_NO_CHARDATA](
"CharData?");
38 prods[PROD_CHARDATA](
"CharData?") >>
"CharData?",
"DataChar";
39 prods[PROD_TAGFILL](
"TagFill") >>
"Attributes",
"S?";
40 prods[PROD_NO_ATTS](
"Attributes");
41 prods[PROD_ATTS](
"Attributes") >>
"Attributes",
"S",
"Attribute";
42 prods[PROD_ATT](
"Attribute") >>
"Name",
"Eq",
"AttValue";
43 prods[PROD_EQ](
"Eq") >>
"S?",
"=",
"S?";
44 prods[PROD_ATTVALUE_D](
"AttValue") >>
"\"",
"DQuoteds",
"\"";
45 prods[PROD_ATTVALUE_S](
"AttValue") >>
"'",
"SQuoteds",
"'";
46 prods[PROD_NO_DQUOTS](
"DQuoteds");
47 prods[PROD_DQUOTS](
"DQuoteds") >>
"DQuoteds",
"DQuoted";
48 prods[PROD_DQUOT_CHAR](
"DQuoted") >>
"DQuotedChar";
49 prods[PROD_DQUOT_REF](
"DQuoted") >>
"Reference";
50 prods[PROD_NO_SQUOTS](
"SQuoteds");
51 prods[PROD_SQUOTS](
"SQuoteds") >>
"SQuoteds",
"SQuoted";
52 prods[PROD_SQUOT_CHAR](
"SQuoted") >>
"SQuotedChar";
53 prods[PROD_SQUOT_REF](
"SQuoted") >>
"Reference";
54 prods[PROD_NAME](
"Name") >>
"NameFirstChar",
"NameChars";
55 prods[PROD_NAME_FIRST_LETTER](
"NameFirstChar") >>
"Letter";
56 prods[PROD_NAME_FIRST_UNDER](
"NameFirstChar") >>
"_";
57 prods[PROD_NAME_FIRST_COLON](
"NameFirstChar") >>
":";
58 prods[PROD_NO_NAME_CHARS](
"NameChars");
59 prods[PROD_NAME_CHARS](
"NameChars") >>
"NameChars",
"NameChar";
60 prods[PROD_NAME_LETTER](
"NameChar") >>
"Letter";
61 prods[PROD_NAME_DIGIT](
"NameChar") >>
"Digit";
62 prods[PROD_NAME_DOT](
"NameChar") >>
".";
63 prods[PROD_NAME_DASH](
"NameChar") >>
"-";
64 prods[PROD_NAME_UNDER](
"NameChar") >>
"_";
65 prods[PROD_NAME_COLON](
"NameChar") >>
":";
66 prods[PROD_NO_MISCS](
"Miscs");
67 prods[PROD_MISCS](
"Miscs") >>
"Miscs",
"Misc";
68 prods[PROD_MISC_COMMENT](
"Misc") >>
"Comment";
69 prods[PROD_MISC_SPACE](
"Misc") >>
"S";
70 prods[PROD_COMMENT](
"Comment") >>
"<",
"!",
"-",
"-",
"Commenteds",
"-",
"-",
">";
71 prods[PROD_NO_COMMENTED](
"Commenteds");
72 prods[PROD_COMMENTED](
"Commenteds") >>
"Commenteds",
"Commented";
73 prods[PROD_COMMENT_CHAR](
"Commented") >>
"CommentChar";
74 prods[PROD_COMMENT_DASH](
"Commented") >>
"-",
"CommentChar";
75 prods[PROD_ENT_REF](
"Reference") >>
"&",
"Name",
";";
76 prods[PROD_CHAR_REF](
"Reference") >>
"&",
"#",
"Digits",
";";
77 prods[PROD_ONE_DIGIT](
"Digits") >>
"Digit";
78 prods[PROD_DIGITS](
"Digits") >>
"Digits",
"Digit";
79 prods[PROD_NO_SPACES](
"S?");
80 prods[PROD_YES_SPACES](
"S?") >>
"S";
81 prods[PROD_ONE_SPACE](
"S") >>
"Space";
82 prods[PROD_SPACES](
"S") >>
"S",
"Space";
83 prods[PROD_DQUOTED_COMMON](
"DQuotedChar") >>
"CommonChar";
84 prods[PROD_DQUOTED_SQUOT](
"DQuotedChar") >>
"'";
85 prods[PROD_DQUOTED_RSQUARE](
"DQuotedChar") >>
"]";
86 prods[PROD_DQUOTED_DASH](
"DQuotedChar") >>
"-";
87 prods[PROD_SQUOTED_CHAR](
"SQuotedChar") >>
"CommonChar";
88 prods[PROD_SQUOTED_DQUOT](
"SQuotedChar") >>
"\"";
89 prods[PROD_SQUOTED_RSQUARE](
"SQuotedChar") >>
"]";
90 prods[PROD_SQUOTED_DASH](
"SQuotedChar") >>
"-";
91 prods[PROD_DATA_COMMON](
"DataChar") >>
"CommonChar";
92 prods[PROD_DATA_SQUOT](
"DataChar") >>
"'";
93 prods[PROD_DATA_DQUOT](
"DataChar") >>
"\"";
94 prods[PROD_DATA_DASH](
"DataChar") >>
"-";
95 prods[PROD_COMMENT_COMMON](
"CommentChar") >>
"CommonChar";
96 prods[PROD_COMMENT_LANGLE](
"CommentChar") >>
"<";
97 prods[PROD_COMMENT_AMP](
"CommentChar") >>
"&";
98 prods[PROD_COMMENT_SQUOT](
"CommentChar") >>
"'";
99 prods[PROD_COMMENT_DQUOT](
"CommentChar") >>
"\"";
100 prods[PROD_COMMENT_RSQUARE](
"CommentChar") >>
"]";
101 prods[PROD_COMMON_SPACE](
"CommonChar") >>
"Space";
102 prods[PROD_COMMON_LETTER](
"CommonChar") >>
"Letter";
103 prods[PROD_COMMON_DIGIT](
"CommonChar") >>
"Digit";
104 prods[PROD_COMMON_EXCL](
"CommonChar") >>
"!";
105 prods[PROD_COMMON_POUND](
"CommonChar") >>
"#";
106 prods[PROD_COMMON_DOT](
"CommonChar") >>
".";
107 prods[PROD_COMMON_SLASH](
"CommonChar") >>
"/";
108 prods[PROD_COMMON_COLON](
"CommonChar") >>
":";
109 prods[PROD_COMMON_SEMICOLON](
"CommonChar") >>
";";
110 prods[PROD_COMMON_RANGLE](
"CommonChar") >>
">";
111 prods[PROD_COMMON_QUESTION](
"CommonChar") >>
"?";
112 prods[PROD_COMMON_EQUAL](
"CommonChar") >>
"=";
113 prods[PROD_COMMON_LSQUARE](
"CommonChar") >>
"[";
114 prods[PROD_COMMON_UNDER](
"CommonChar") >>
"_";
115 prods[PROD_COMMON_OTHER](
"CommonChar") >>
"OtherChar";
116 Language::Tokens& toks = out.tokens;
118 toks[TOK_SPACE](
"Space",
"[ \t\r\n]");
119 toks[TOK_LETTER](
"Letter",
"[a-zA-Z]");
120 toks[TOK_DIGIT](
"Digit",
"[0-9]");
121 toks[TOK_EXCL](
"!",
"!");
122 toks[TOK_DQUOTE](
"\"",
"\"");
123 toks[TOK_SQUOTE](
"'",
"'");
124 toks[TOK_POUND](
"#",
"#");
125 toks[TOK_AMP](
"&",
"&");
126 toks[TOK_DASH](
"-",
"\\-");
127 toks[TOK_DOT](
".",
"\\.");
128 toks[TOK_SLASH](
"/",
"/");
129 toks[TOK_COLON](
":",
":");
130 toks[TOK_SEMICOLON](
";",
";");
131 toks[TOK_LANGLE](
"<",
"<");
132 toks[TOK_RANGLE](
">",
">");
133 toks[TOK_QUESTION](
"?",
"\\?");
134 toks[TOK_EQUAL](
"=",
"=");
135 toks[TOK_LSQUARE](
"[",
"\\[");
136 toks[TOK_RSQUARE](
"]",
"\\]");
137 toks[TOK_UNDER](
"_",
"_");
138 toks[TOK_OTHER](
"OtherChar",
"[$%\\(\\)\\*\\+,@\\\\\\^`{}\\|~]");
144 if (ptr.strong_count() == 0) {
145 ptr.reset(
new Language(make_language()));
152 if (ptr.strong_count() == 0) {
Productions productions
vector of productions
RCP< const ReaderTables > ReaderTablesPtr
an RCP to a const ReaderTables
ReaderTablesPtr make_reader_tables(Language const &language)
constructs ReaderTables for the given Language.
RCP< const Language > LanguagePtr
an RCP to a const Language