Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/parsifal/good/xmlp8.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/parsifal/good/xmlp8.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,2269 @@ +/* + * XML Syntax + * Transcribed from + * Extensible Markup Language (XML) 1.0 + * W3C Recommendation 10-February-1998 + * http://www.w3.org/TR/1998/REC-xml-19980210 + * + * Transcription Copyright © Parsifal Software, 1999. + * + * Revision 1 fixed definition of [4] NameChar + * + * Revision 2, begun 1/24/00 + * + * Fixed problem with mixed content declaration [51] + * Fixed missing S in [52] + * Removed unnecessary "sticky" statement +*/ + +#include "xmldef8.h" +#include <stdio.h> + + +/* + * AnaGram, A System for Syntax Directed Programming + * File generated by: ... + * + * AnaGram Parsing Engine + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef XMLP8_H +#include "xmlp8.h" +#endif + +#ifndef XMLP8_H +#error Mismatched header file +#endif + +#include <ctype.h> +#include <stdio.h> + +#define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) +#define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) +#define CONTEXT ((PCB).cs[(PCB).ssx]) + + +#ifndef PCB_TYPE +#define PCB_TYPE parse_pcb_type +#endif + + +#define PCB (*pcb_pointer) +#define PCB_DECL PCB_TYPE *pcb_pointer +#define PCB_POINTER pcb_pointer +static void ag_delete_wrappers(PCB_DECL); +#ifndef DELETE_WRAPPERS +#define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER) +#endif + +/* Line -, xmlp8.syn */ + #define GET_CONTEXT CONTEXT = Context(PCB.line, PCB.column) + + typedef parse_pcb_struct Pcb; + + parse_pcb_struct::parse_pcb_struct() + : tokenType(Pcb::none), dtdPresent(0) + { + // Nothing to do + } + + void parse_pcb_struct::spaceChar(int c) { + if (c == '\r') c = '\n'; + if (textStack.size()) tokenType = textType; + spaceStack.concat(c); + } + + void parse_pcb_struct::textChar(int c) { + if (spaceStack.size()) tokenType=spaceType; + textStack.concat((char)c); + } + + void parse_pcb_struct::normalize(AgString &s) { + char *readPointer = s; + char *writePointer = readPointer; + if (readPointer == NULL) return; + while (*readPointer && strchr("\t\r\n ",*readPointer)) readPointer++; + while (*readPointer) { + while (*readPointer && strchr("\t\r\n ",*readPointer) == NULL) *writePointer++ = *readPointer++; + while (*readPointer && strchr("\t\r\n ",*readPointer)) readPointer++; + if (*readPointer) *writePointer++ = ' '; + } + *writePointer = 0; + } + + void parse_pcb_struct::checkAttributes(const Context &context, const AgString &name, Symtab &map) { + if (!dtdPresent) return; + Element &element = elementMap[name]; + AgBaseStack<Attribute> &attributeList = element.attributeList; + int i; + for (i = 0; i < attributeList.size(); i++) { + Attribute &attribute = attributeList[i]; + switch (attribute.def.presence) { + case Default::REQUIRED: { + const char *value = map.findValue(attribute.name); + if (value) continue; + map[attribute.name] = "VALUE NOT SPECIFIED"; + char buf[200]; + sprintf(buf, "Required attribute '%s' is missing", (const char *)attribute.name); + warningList.push(Warning(context, buf)); + break; + } + case Default::DEFAULT: { + const char *value = map[attribute.name]; + if (value == 0) value = attribute.def.value; + if (attribute.def.fixed && attribute.def.value == value) continue; + char buf[200]; + sprintf(buf, "Value of fixed attribute '%s' does not match default value ", + (const char *) attribute.name); + warningList.push(Warning(context, buf)); + break; + } + } + } + for (i = 0; i < attributeList.size(); i++) { + Attribute &attribute = attributeList[i]; + if (attribute.type != Attribute::CDATA) normalize(map[attribute.name]); + } + } + + int parse_pcb_struct::warnAttval(const Context &context, const char *value, const AttvalPair &p) { + if (value == NULL) return 0; + char buf[200]; + sprintf(buf, "Value of '%s' ignored. Previously specified as '%s'", + (const char *) p.name, value); + warningList.push(Warning(context, buf)); + return 1; + } + + void parse_pcb_struct::startTag(const Context &context, const AgString &name, AttvalList &list) { + Symtab map; + for (int i = 0; i < list.size(); i++) { + AgString &value = map[list[i].name]; + if (warnAttval(context, value, list[i])) continue; + value = list[i].value; + } + currentTagName = name; + checkAttributes(context, name, map); + currentMap = map; + tagStack.push(name); + mapStack.push(map); + tokenType = startType; + } + + void parse_pcb_struct::emptyTag(const Context &context, const AgString &name, AttvalList &list) { + Symtab map; + for (int i = 0; i < list.size(); i++) { + AgString &value = map[list[i].name]; + if (warnAttval(context, value, list[i])) continue; + map[list[i].name] = list[i].value; + } + checkAttributes(context, name, map); + currentTagName = name; + currentMap = map; + tokenType = emptyType; + } + + void parse_pcb_struct::endTag(const AgString &name) { + currentTagName = name; + currentMap = mapStack.pop(); + if (name != tagStack.pop()) { + error_message = "Element nesting error"; + exit_flag = AG_SEMANTIC_ERROR_CODE; + tokenType = errorType; + return; + } + tokenType = endType; + } + void parse_pcb_struct::registerAttributes(const AgString &name, const AgBaseStack<Attribute> &attributeList) { + Element &element = elementMap[name]; + if (element.name.size() == 0) element.name = name; + int i; + for (i = 0; i < attributeList.size(); i++) { + AgString attributeName = attributeList[i].name; + int &index = element.attributeIndex[attributeName]; + if (index != -1) { + Attribute &attribute = element.attributeList[index]; + Context previous = attribute.context; + char buf[200]; + sprintf(buf, "Redefinition of '%s::%s' ignored. Defined at line %d, column %d", + (const char *) name, + (const char *) attributeName, previous.line, previous.column); + warningList.push(Warning(attributeList[i].context, buf)); + continue; + } + index = element.attributeList.size(); + element.attributeList.push(attributeList[i]); + } + } + +#ifndef CONVERT_CASE +#define CONVERT_CASE(c) (c) +#endif +#ifndef TAB_SPACING +#define TAB_SPACING 8 +#endif + +static inline AgString ag_rp_1(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + return AgString().concat(c); +} + +static inline AgString ag_rp_2(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline AgString ag_rp_3(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s; +} + +static inline AgString ag_rp_4(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s; +} + +static inline AgString ag_rp_5(PCB_DECL) { +/* Line -, xmlp8.syn */ + return AgString(); +} + +static inline AgString ag_rp_6(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline AgString ag_rp_7(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s.concat(' '); +} + +static inline AgString ag_rp_8(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline AgString ag_rp_9(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s; +} + +static inline AgString ag_rp_10(PCB_DECL) { +/* Line -, xmlp8.syn */ + return AgString(); +} + +static inline AgString ag_rp_11(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline AgString ag_rp_12(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s.concat(' '); +} + +static inline AgString ag_rp_13(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline AgString ag_rp_14(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return s; +} + +static inline void ag_rp_15(PCB_DECL, AgString &t) { +/* Line -, xmlp8.syn */ + PCB.tokenType = Pcb::commentType, PCB.commentString = t; +} + +static inline AgString ag_rp_16(PCB_DECL) { +/* Line -, xmlp8.syn */ + return AgString(); +} + +static inline AgString ag_rp_17(PCB_DECL, AgString &s, int c) { +/* Line -, xmlp8.syn */ + return s.concat(c); +} + +static inline void ag_rp_18(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + PCB.textChar(c); +} + +static inline void ag_rp_19(PCB_DECL) { +/* Line -, xmlp8.syn */ + PCB.spaceChar('\n'); +} + +static inline void ag_rp_20(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + PCB.spaceChar(c); +} + +static inline void ag_rp_21(PCB_DECL, AgString &n) { +/* Line -, xmlp8.syn */ + PCB.dtdPresent=1; +} + +static inline void ag_rp_22(PCB_DECL, AgString &n, AttvalList &l) { +/* Line -, xmlp8.syn */ + PCB.startTag(CONTEXT, n, l); +} + +static inline AttvalList ag_rp_23(PCB_DECL) { +/* Line -, xmlp8.syn */ + return AttvalList(); +} + +static inline AttvalList ag_rp_24(PCB_DECL, AttvalList &list, AttvalPair &a) { +/* Line -, xmlp8.syn */ + return list.push(a); +} + +static inline AttvalPair ag_rp_25(PCB_DECL, AgString &n, AgString &s) { +/* Line -, xmlp8.syn */ + return AttvalPair(n, s, CONTEXT); +} + +static inline void ag_rp_26(PCB_DECL, AgString &n) { +/* Line -, xmlp8.syn */ + PCB.endTag(n); +} + +static inline void ag_rp_27(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + PCB.textChar(c); +} + +static inline void ag_rp_28(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + PCB.textChar(c); +} + +static inline void ag_rp_29(PCB_DECL, int c) { +/* Line -, xmlp8.syn */ + PCB.spaceChar(c); +} + +static inline void ag_rp_30(PCB_DECL) { +/* Line -, xmlp8.syn */ + PCB.spaceChar('\n'); +} + +static inline void ag_rp_31(PCB_DECL, AgString &n, AttvalList &l) { +/* Line -, xmlp8.syn */ + PCB.emptyTag(CONTEXT, n, l); +} + +static inline void ag_rp_32(PCB_DECL, AgString &n, AttributeList &l) { +/* Line -, xmlp8.syn */ + PCB.registerAttributes(n, l); +} + +static inline AttributeList ag_rp_33(PCB_DECL, Attribute &a) { +/* Line -, xmlp8.syn */ + return AttributeList().push(a); +} + +static inline AttributeList ag_rp_34(PCB_DECL, AttributeList &l, Attribute &a) { +/* Line -, xmlp8.syn */ + return l.push(a); +} + +static inline Attribute ag_rp_35(PCB_DECL, AgString &n, Attribute::Type t, Default &d) { +/* Line -, xmlp8.syn */ + return Attribute(RULE_CONTEXT[1], n, t, d); +} + +static inline Attribute::Type ag_rp_36(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::CDATA; +} + +static inline Attribute::Type ag_rp_37(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::ID; +} + +static inline Attribute::Type ag_rp_38(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::IDREF; +} + +static inline Attribute::Type ag_rp_39(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::IDREFS; +} + +static inline Attribute::Type ag_rp_40(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::ENTITY; +} + +static inline Attribute::Type ag_rp_41(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::ENTITIES; +} + +static inline Attribute::Type ag_rp_42(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::NMTOKEN; +} + +static inline Attribute::Type ag_rp_43(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::NMTOKENS; +} + +static inline Attribute::Type ag_rp_44(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::NOTATION; +} + +static inline Attribute::Type ag_rp_45(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Attribute::ENUMERATION; +} + +static inline Default ag_rp_46(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Default(Default::REQUIRED); +} + +static inline Default ag_rp_47(PCB_DECL) { +/* Line -, xmlp8.syn */ + return Default(); +} + +static inline Default ag_rp_48(PCB_DECL, AgString &v) { +/* Line -, xmlp8.syn */ + return Default(v); +} + +static inline Default ag_rp_49(PCB_DECL, AgString &v) { +/* Line -, xmlp8.syn */ + return Default(v,1); +} + +static inline int ag_rp_50(PCB_DECL, int d) { +/* Line -, xmlp8.syn */ + return d-'0'; +} + +static inline int ag_rp_51(PCB_DECL, int n, int d) { +/* Line -, xmlp8.syn */ + return 10*n + d-'0'; +} + +static inline int ag_rp_52(PCB_DECL, int d) { +/* Line -, xmlp8.syn */ + return d-'0'; +} + +static inline int ag_rp_53(PCB_DECL, int n, int d) { +/* Line -, xmlp8.syn */ + return 16*n + d; +} + +static inline int ag_rp_54(PCB_DECL, int n, int d) { +/* Line -, xmlp8.syn */ + return 16*n + (d&7) + 9; +} + +static inline int ag_rp_55(PCB_DECL, AgString &s) { +/* Line -, xmlp8.syn */ + return PCB.currentEntityName = s, PCB.tokenType = Pcb::entityRefType; +} + + +#define READ_COUNTS +#define WRITE_COUNTS +#undef V +#define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) +#undef VS +#define VS(i) (PCB).vs[(PCB).ssx + i] + +#ifndef GET_CONTEXT +#define GET_CONTEXT CONTEXT = (PCB).input_context +#endif + +typedef enum { + ag_action_1, + ag_action_2, + ag_action_3, + ag_action_4, + ag_action_5, + ag_action_6, + ag_action_7, + ag_action_8, + ag_action_9, + ag_action_10, + ag_action_11, + ag_action_12 +} ag_parser_action; + + +#ifndef NULL_VALUE_INITIALIZER +#define NULL_VALUE_INITIALIZER = { 0 } +#endif + + +static const char ag_wdf[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 0, 0, 5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, + 0, 0, 0, 0, 8, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5 +}; + +#undef VW +#define VW(i,t) *(t) (&(PCB).vs[(PCB).ssx + (i)]) +#undef VNO +#define VNO new(&(PCB).vs[(PCB).ssx]) +#undef VRO +#define VRO(to,v) ag_replace_object((to) &(PCB).vs[(PCB).ssx], v) +#undef VWD +#define VWD(i,t) ag_delete_object((t) &(PCB).vs[(PCB).ssx + (i)]); +#undef VDO +#define VDO(to, v) ag_delete_object((to) &(PCB).vs[(PCB).ssx], v) + +template <class NewObject, class OldObject> +static inline void ag_replace_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { + delete p; + new(p) AgObjectWrapper<NewObject >(o); +} + +template <class Object> +static inline void ag_delete_object(AgObjectWrapper<Object> *p) { + delete p; +} + +template <class NewObject, class OldObject> +static inline const NewObject &ag_delete_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { + delete p; + return o; +} + + +#undef AG_WRAP_4 +#define AG_WRAP_4 AgObjectWrapper<AttvalPair > +#undef AG_WRAP_5 +#define AG_WRAP_5 AgObjectWrapper<AgString > +#undef AG_WRAP_6 +#define AG_WRAP_6 AgObjectWrapper<AttvalList > +#undef AG_WRAP_7 +#define AG_WRAP_7 AgObjectWrapper<Attribute > +#undef AG_WRAP_8 +#define AG_WRAP_8 AgObjectWrapper<AttributeList > +#undef AG_WRAP_9 +#define AG_WRAP_9 AgObjectWrapper<Default > + +static void ag_delete_wrappers(PCB_DECL) { + int sn = (PCB).sn; + int sx = (PCB).ssx; + while (sx--) { + switch (ag_wdf[sn]) { + case 4: ag_delete_object((AG_WRAP_4 *) &(PCB).vs[sx]); break; + case 5: ag_delete_object((AG_WRAP_5 *) &(PCB).vs[sx]); break; + case 6: ag_delete_object((AG_WRAP_6 *) &(PCB).vs[sx]); break; + case 7: ag_delete_object((AG_WRAP_7 *) &(PCB).vs[sx]); break; + case 8: ag_delete_object((AG_WRAP_8 *) &(PCB).vs[sx]); break; + case 9: ag_delete_object((AG_WRAP_9 *) &(PCB).vs[sx]); break; + default: break; + } + sn = (PCB).ss[sx]; + } +} + +static parse_vs_type const ag_null_value NULL_VALUE_INITIALIZER; + +static const unsigned char ag_rpx[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 20, 21, 22, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 24, 25, 26, 27, 28, 0, 0, 0, 0, 29, 30, + 0, 31, 32, 0, 0, 0, 33, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 34, 0, + 0, 0, 0, 0, 0, 0, 35, 36, 37, 38, 0, 0, 0, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 4, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 49, + 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 53, 54, 55, 56, 57, 0, 0, 58, 59, 0, 0, 4, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4 +}; + +static const unsigned char ag_key_itt[] = { + 0 +}; + +static const unsigned short ag_key_pt[] = { +0 +}; + +static const unsigned char ag_key_ch[] = { + 0, 45, 68,255,120,255, 33, 63,255, 60,255, 45, 68,255, 33, 63,255, 60, + 255,110,121,255, 70, 73, 80, 82,255,110,121,255, 73, 89,255, 84,255, 73, + 255, 84,255, 77, 78,255, 83,255, 70,255, 69,255, 82,255, 68,255, 83,255, + 78,255, 69,255, 75,255, 79,255, 84,255, 68, 77, 79,255, 34, 35, 39, 41, + 47, 63, 65, 67, 69, 73, 78, 80, 83,101,115,118,255,118,255, 45,255, 60, + 255,120,255, 35,255, 45, 91,255, 33, 63,255, 13, 38, 60,255, 33, 63,255, + 60,255, 63,255, 47,255, 13, 93,255,120,255, 35,255, 45, 91,255, 33, 47, + 63,255, 13, 38, 60,255, 60,255,110,121,255, 34, 39, 63,101,115,255, 93, + 255, 39,255,110,121,255, 34, 39, 63,115,255, 80, 83,255, 76, 78,255, 45, + 65, 69, 78,255, 33, 63,255, 60,255,120,255, 35,255, 38,255, 65, 69,255, + 35,255, 78,255, 73, 89,255, 84,255, 73,255, 84,255, 78,255, 83,255, 70, + 255, 69,255, 82,255, 68,255, 83,255, 78,255, 69,255, 75,255, 79,255, 84, + 255, 77, 79,255, 67, 69, 73, 78,255, 41,255, 70, 73, 82,255, 35,255 +}; + +static const unsigned char ag_key_act[] = { + 0,3,3,4,3,4,2,1,4,2,4,3,3,4,2,0,4,2,4,3,3,4,3,3,3,3,4,3,3,4,3,0,4,2,4, + 2,4,2,4,3,2,4,0,4,1,4,2,4,2,4,1,4,0,4,1,4,2,4,2,4,2,4,2,4,3,2,3,4,2,2, + 2,3,3,3,3,3,2,2,2,3,3,3,3,3,4,3,4,3,4,3,4,0,4,1,4,3,3,4,2,0,4,3,2,2,4, + 3,0,4,2,4,3,4,3,4,3,3,4,0,4,1,4,3,3,4,2,0,0,4,3,2,2,4,3,4,3,3,4,2,3,3, + 3,3,4,3,4,3,4,3,3,4,2,3,3,3,4,3,3,4,3,3,4,3,3,2,3,4,2,0,4,2,4,0,4,1,4, + 2,4,3,3,4,3,4,3,4,3,0,4,2,4,2,4,2,4,2,4,0,4,1,4,2,4,2,4,1,4,0,4,1,4,2, + 4,2,4,2,4,2,4,2,3,4,3,2,2,2,4,3,4,3,3,3,4,2,4 +}; + +static const unsigned short ag_key_parm[] = { + 0, 59, 97, 0, 84, 0, 0, 64, 0, 0, 0, 59, 97, 0, 0, 64, 0, 0, + 0,124,122, 0,208,207,176,206, 0,123,121, 0,194,193, 0, 0, 0, 0, + 0, 0, 0,154, 0, 0,192, 0,191, 0, 0, 0, 0, 0,190, 0,196, 0, + 195, 0, 0, 0, 0, 0, 0, 0, 0, 0,239, 0,199, 0, 0, 0, 0,180, + 151, 2,155,189, 0, 0, 0,238,237,243,120, 90, 0, 90, 0, 1, 0, 97, + 0,226, 0,224, 0, 59, 75, 0, 0, 64, 0, 76, 0, 0, 0, 59, 64, 0, + 0, 0, 2, 0,151, 0, 76, 3, 0,226, 0,224, 0, 59, 75, 0, 0,147, + 64, 0, 76, 0, 0, 0,147, 0,124,122, 0, 0,123, 2,243,120, 0, 3, + 0,121, 0,124,122, 0, 0,123, 2,120, 0,238,237, 0,152,232, 0, 59, + 181, 0,250, 0, 0, 64, 0, 0, 0,226, 0,224, 0, 0, 0,155,154, 0, + 176, 0,239, 0,194,193, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 0,191, + 0, 0, 0, 0, 0,190, 0,196, 0,195, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,199, 0,189, 0, 0, 0, 0,180, 0,208,207,206, 0, 0, 0 +}; + +static const unsigned short ag_key_jmp[] = { + 0, 0, 2, 0, 9, 0, 1, 4, 0, 6, 0, 12, 14, 0, 11, 0, 0, 14, + 0, 21, 24, 0, 28, 33, 40, 46, 0, 54, 57, 0, 79, 0, 0, 30, 0, 33, + 0, 35, 0, 75, 37, 0, 0, 0, 42, 0, 44, 0, 46, 0, 48, 0, 0, 0, + 52, 0, 54, 0, 56, 0, 58, 0, 60, 0, 82, 62, 86, 0, 19, 22, 27, 61, + 63, 65, 67, 70, 39, 50, 64, 93, 99,105,113,123, 0,130, 0,137, 0,139, + 0, 0, 0, 91, 0,150,152, 0, 95, 0, 0,148, 93, 98, 0,159, 0, 0, + 105, 0,162, 0,164, 0,166,168, 0, 0, 0,117, 0,173,175, 0,121, 0, + 0, 0,171,119,124, 0,182, 0,184,187, 0,134,191,195,197,205, 0,215, + 0,218, 0,223,226, 0,147,230,234,236, 0,246,252, 0,267,273, 0,258, + 260,158,278, 0,161, 0, 0,166, 0, 0, 0,171, 0,173, 0,286,289, 0, + 294, 0,301, 0,311, 0, 0,184, 0,187, 0,189, 0,191, 0, 0, 0,195, + 0,197, 0,199, 0,201, 0, 0, 0,205, 0,207, 0,209, 0,211, 0,213, + 0,215,314, 0,306,193,203,217, 0,321, 0,323,328,335, 0,227, 0 +}; + +static const unsigned char ag_key_index[] = { + 9, 0, 17, 0, 68, 85, 0, 87, 17, 89, 0,101,108, 0,110,110,110, 87, + 0,108,112, 0, 0,114, 0, 0, 0,128,132, 0, 0, 0,137,110,110,110, + 0, 0,112,114,143, 0, 0,145, 0, 0, 0,110, 0,110,110, 0,112,112, + 0, 0, 0, 0,145, 0,150,110,155, 0, 0, 0, 0, 0,110, 0, 0, 0, + 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,169, 0,175,175, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,175,175, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,155,155, 0, 0,177, 0,175,175, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,180, 0,155,175, 0,175, 0,182, + 0,220,180, 0, 0, 0, 0, 0, 0, 0,225, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,231, 0,225, 0,225,225,225, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,225, 0, 0, 0, 0, 0,225, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const unsigned char ag_key_ends[] = { +45,0, 79,67,84,89,80,69,0, 109,108,0, 45,0, 79,67,84,89,80,69,0, +111,34,0, 101,115,34,0, 73,88,69,68,0, 77,80,76,73,69,68,0, +67,68,65,84,65,0, 69,81,85,73,82,69,68,0, 111,39,0, 101,115,39,0, +42,0, 62,0, 62,0, 78,89,0, 68,65,84,65,0, 80,84,89,0, 69,83,0, +65,84,65,0, 84,65,84,73,79,78,0, 85,66,76,73,67,0, +89,83,84,69,77,0, 110,99,111,100,105,110,103,0, +116,97,110,100,97,108,111,110,101,0, 101,114,115,105,111,110,0, +101,114,115,105,111,110,0, 45,0, 33,68,79,67,84,89,80,69,0, 10,0, +45,0, 67,68,65,84,65,91,0, 45,45,0, 62,0, 62,0, 10,0, 93,62,0, +10,0, 45,0, 67,68,65,84,65,91,0, 47,0, 111,34,0, 101,115,34,0, +110,111,39,0, 62,0, 110,99,111,100,105,110,103,0, +116,97,110,100,97,108,111,110,101,0, 93,62,0, 121,101,115,39,0, +111,34,0, 101,115,34,0, 110,111,39,0, 62,0, +116,97,110,100,97,108,111,110,101,0, 85,66,76,73,67,0, +89,83,84,69,77,0, 45,0, 84,84,76,73,83,84,0, 69,77,69,78,84,0, +84,73,84,89,0, 79,84,65,84,73,79,78,0, 78,89,0, 77,80,84,89,0, +80,67,68,65,84,65,0, 68,65,84,65,0, 68,65,84,65,0, 69,83,0, +84,65,84,73,79,78,0, 42,0, 73,88,69,68,0, 77,80,76,73,69,68,0, +69,81,85,73,82,69,68,0, +}; +#define AG_TCV(x) (((int)(x) >= -1 && (int)(x) <= 255) ? ag_tcv[(x) + 1] : 0) + +static const unsigned short ag_tcv[] = { + 10,262,262,262,262,262,262,262,262,262,253,254,262,262,255,262,262,262, + 262,262,262,262,262,262,262,262,262,262,262,262,262,262,262,254,263, 25, + 263,263,229,228, 32,167,172,162,163,173,127,260,263,225,225,225,225,225, + 225,225,225,225,225,256,222,144, 94, 61,161,263,227,227,227,227,227,227, + 257,257,137,257,257,257,257,257,257,257,257,257,257,257,257,257,257,139, + 257,257,101,264,106,264,258,264,227,227,227,227,227,227,257,257,137,257, + 257,257,257,257,257,257,257,257,257,257,257,257,257,139,257,257,264,168, + 264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, + 264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, + 264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, + 264,264,264,264,261,264,264,264,264,264,264,264,264,259,259,259,259,259, + 259,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259, + 264,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259,259, + 259,259,259,259,259,259,259,259,259,259,259,259,259,259,264,259,259,259, + 259,259,259,259,259 +}; + +#ifndef SYNTAX_ERROR +#define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ + (PCB).error_message, (PCB).line, (PCB).column) +#endif + +#ifndef FIRST_LINE +#define FIRST_LINE 1 +#endif + +#ifndef FIRST_COLUMN +#define FIRST_COLUMN 1 +#endif + +#ifndef PARSER_STACK_OVERFLOW +#define PARSER_STACK_OVERFLOW {fprintf(stderr, \ + "\nParser stack overflow, line %d, column %d\n",\ + (PCB).line, (PCB).column);} +#endif + +#ifndef REDUCTION_TOKEN_ERROR +#define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ + "\nReduction token error, line %d, column %d\n", \ + (PCB).line, (PCB).column);} +#endif + + +typedef enum + {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, + ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; + + +#ifndef AG_NEWLINE +#define AG_NEWLINE 10 +#endif + +#ifndef AG_RETURN +#define AG_RETURN 13 +#endif + +#ifndef AG_FORMFEED +#define AG_FORMFEED 12 +#endif + +#ifndef AG_TABCHAR +#define AG_TABCHAR 9 +#endif + +static void ag_track(PCB_DECL) { + int ag_k = 0; + while (ag_k < (PCB).rx) { + int ag_ch = (PCB).lab[ag_k++]; + switch (ag_ch) { + case AG_NEWLINE: + (PCB).column = 1, (PCB).line++; + case AG_RETURN: + case AG_FORMFEED: + break; + case AG_TABCHAR: + (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); + break; + default: + (PCB).column++; + } + } + ag_k = 0; + while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++]; + (PCB).fx = ag_k; + (PCB).rx = 0; +} + + +static void ag_prot(PCB_DECL) { + int ag_k; + ag_k = 128 - ++(PCB).btsx; + if (ag_k <= (PCB).ssx) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + return; + } + (PCB).bts[(PCB).btsx] = (PCB).sn; + (PCB).bts[ag_k] = (PCB).ssx; + (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; + (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; + (PCB).cs[ag_k] = (PCB).cs[(PCB).ssx]; +} + +static void ag_undo(PCB_DECL) { + if ((PCB).drt == -1) return; + while ((PCB).btsx) { + int ag_k = 128 - (PCB).btsx; + (PCB).sn = (PCB).bts[(PCB).btsx--]; + (PCB).ssx = (PCB).bts[ag_k]; + (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; + (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; + (PCB).cs[(PCB).ssx] = (PCB).cs[ag_k]; + } + (PCB).token_number = (parse_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + +static const unsigned short ag_tstt[] = { +255,254,253,144,97,84,64,59,0,4,5,80,81, +255,254,253,0,11,13, +255,254,253,144,97,64,59,0,7,8,9,58,63, +144,0,6,140,141, +255,254,253,0, +90,0,85, +259,258,257,256,227,139,137,0,14,65, +264,263,261,260,259,258,257,256,254,253,229,228,227,225,222,173,172,168,167, + 163,162,161,144,139,137,127,106,101,94,61,32,25,1,0,60, +255,254,253,64,59,0,7,58,63, +144,97,0,82,83, +259,258,257,256,227,139,137,0,14, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,76,75,64,61,59, + 32,25,0,6,41,42,58,63,71,72,140,141,142,148,149,221,223, +255,254,253,64,59,10,0,7,8,9,58,63, +255,254,253,94,0,11,13,87,91, +255,254,253,2,0,11,13,86,87, +261,260,259,258,257,256,227,225,139,137,127,0, +255,254,253,2,0,11,13,70, +264,263,261,260,259,258,257,256,254,253,229,228,227,225,222,173,172,168,167, + 163,162,161,144,139,137,127,106,101,94,61,32,25,1,0, +255,254,253,0,11,13, +255,254,253,144,64,59,0,7,8,9,58,63, +261,260,259,258,257,256,255,254,253,227,225,151,139,137,127,61,0,145, +225,0, +225,0, +264,263,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172,168, + 167,163,162,161,144,139,137,127,106,101,94,76,61,32,25,3,0,73,77,78,79, +259,258,257,256,227,139,137,0,14, +227,225,222,0, +225,222,0, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,76,75,64,61,59, + 32,25,0,6,41,42,58,63,71,72,140,141,148,221,223, +147,0,143, +10,0, +94,0, +32,25,0,93, +243,124,123,122,120,0,88,89, +2,0, +264,263,261,260,259,258,257,256,229,228,227,225,222,173,172,168,167,163,162, + 161,144,139,137,127,106,101,94,61,32,25,2,0,69, +2,0, +61,0, +259,258,257,256,227,139,137,0,14, +255,254,253,151,61,0,11,13,87, +264,263,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172,168, + 167,163,162,161,144,139,137,127,106,101,94,76,61,32,25,0,77, +3,0,74, +261,260,259,258,257,256,227,225,222,139,137,127,0, +259,258,257,256,227,139,137,0,14, +255,254,253,121,32,25,0,11,13,87, +260,258,257,256,227,225,139,137,127,0,92,96, +260,258,257,256,227,225,139,137,127,0,92,96, +255,254,253,94,0,11,13,87,91, +255,254,253,2,0,11,13,87, +255,254,253,94,0,11,13,87,91, +255,254,253,2,0,11,13,87, +264,263,261,260,259,258,257,256,254,253,229,228,227,225,222,173,172,168,167, + 163,162,161,144,139,137,127,106,101,94,61,32,25,2,0,67,68, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,101,61,0,11,13,100, +259,258,257,256,227,139,137,0,14,146, +151,61,0, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,61,0,11,13,87, +260,258,257,256,227,225,139,137,127,0, +25,0, +32,0, +121,0, +32,25,0,245, +124,123,122,120,0,89, +264,263,261,260,259,258,257,256,254,253,229,228,227,225,222,173,172,168,167, + 163,162,161,144,139,137,127,106,101,94,61,32,25,0, +238,237,101,61,0,98,99, +101,61,0,107, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,94,0,11,13,87,91, +61,0, +257,227,139,137,0,244, +257,227,139,137,0,244, +255,254,253,2,0,11,13,87, +255,254,253,0,11,13, +255,254,253,0,11,13, +255,254,253,101,61,0,11,13,87, +255,254,253,250,232,229,181,152,106,64,59,0,27,58,63,102,103,104,105,108, + 109,110,111,230,231, +61,0, +32,25,0,37, +258,257,227,225,139,137,127,32,25,0,247,248,249, +32,0, +25,0, +32,25,0,51, +32,25,0,44, +255,254,253,0,11,13, +255,254,253,0,11,13, +255,254,253,0,11,13, +255,254,253,0,11,13, +259,258,257,256,227,139,137,0,14, +255,254,253,250,232,229,181,152,64,59,0,27,58,63,102,103,108,109,110,111, + 230,231, +106,0, +264,263,262,261,260,259,258,257,256,255,254,253,228,227,226,225,224,222,173, + 172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,39, +264,263,262,261,260,259,258,257,256,255,254,253,228,227,226,225,224,222,173, + 172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,38, +258,257,227,225,139,137,127,0,247, +263,260,258,257,256,255,254,229,227,225,222,173,172,167,163,162,161,139,137, + 127,32,0,56,57, +263,260,258,257,256,255,254,229,227,225,222,173,172,167,163,162,161,139,137, + 127,32,25,0,53,54, +255,254,253,0,11,13, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172, + 168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,49,50, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172, + 168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,46,47, +259,258,257,256,229,227,139,137,0,14, +259,258,257,256,227,139,137,0,14, +259,258,257,256,227,139,137,0,14, +259,258,257,256,227,139,137,0,14, +261,260,259,258,257,256,227,225,222,139,137,127,0, +255,254,253,61,0,11,13,87, +264,263,262,261,260,259,258,257,256,255,254,253,228,227,226,225,224,222,173, + 172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,41,42,221, + 223, +264,263,262,261,260,259,258,257,256,255,254,253,228,227,226,225,224,222,173, + 172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,41,42,221, + 223, +263,260,258,257,256,255,254,229,227,225,222,173,172,167,163,162,161,139,137, + 127,0, +32,0, +263,260,258,257,256,255,254,229,227,225,222,173,172,167,163,162,161,139,137, + 127,32,0, +25,0, +32,25,0,44, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172, + 168,167,163,162,161,144,139,137,127,106,101,94,61,25,0, +32,0, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,225,222,173,172, + 168,167,163,162,161,144,139,137,127,106,101,94,61,32,0, +25,0, +255,254,253,0,11,13, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13,182,183, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13, +259,258,257,256,227,139,137,0,14, +238,237,32,25,0,24,98,233, +238,237,0,98,251,252, +259,258,257,256,227,139,137,0,14, +255,254,253,61,0,11,13,87,183, +167,155,154,0,153,156,157,158,159,160, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,27,28, + 34,35,36,41,42,221,223, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,25,0,27,28, + 29,30,31,41,42,221,223, +255,254,253,61,0,11,13,235,236, +255,254,253,61,0,11,13,87, +61,0, +255,254,253,0,11,13, +255,254,253,61,0,11,13,87, +61,0, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13, +259,258,257,256,227,139,137,0,14, +61,0, +255,254,253,163,162,161,61,0,164, +259,258,257,256,255,254,253,227,176,167,139,137,0,11,13,87, +255,254,253,61,0,11,13,87, +238,237,32,25,0,24,98,234, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,61,25,0,27,28,34, + 41,42,221,223, +32,0, +264,263,262,261,260,259,258,257,256,255,254,253,229,228,227,226,225,224,222, + 173,172,168,167,163,162,161,144,139,137,127,106,101,94,61,32,0,27,28,29, + 41,42,221,223, +25,0, +239,0, +32,25,0,51, +199,196,195,194,193,192,191,190,189,167,0,184,186,187,188,197,198, +259,258,257,256,227,176,167,139,137,0,14,158,159,165,166, +61,0, +255,254,253,61,0,11,13,87, +255,254,253,0,11,13, +255,254,253,61,0,11,13,87, +261,260,259,258,257,256,227,225,139,137,127,0,18,19, +255,254,253,0,11,13, +255,254,253,0,11,13, +255,254,253,180,172,168,0,11,13,87,177,178,179, +259,258,257,256,255,254,253,227,167,139,137,0,11,13,87, +261,260,259,258,257,256,227,225,139,137,127,0, +255,254,253,173,172,168,163,162,161,0,164, +255,254,253,173,172,168,0,11,13,87, +61,0, +259,258,257,256,227,139,137,0,14, +32,25,0,44, +261,260,259,258,257,256,227,225,139,137,127,0, +255,254,253,172,168,0,11,13,87, +167,0, +208,207,206,32,25,0,37,185, +172,0, +180,172,168,0, +259,258,257,256,255,254,253,227,139,137,0,11,13,87, +168,0, +255,254,253,0,11,13, +180,0, +259,258,257,256,227,167,139,137,0,14,158,159,165,166, +173,172,168,0,169,170,171,174,175, +261,260,259,258,257,256,227,225,139,137,127,0, +172,168,0,203,204,205, +259,258,257,256,227,139,137,0,14, +255,254,253,0,11,13, +259,258,257,256,227,139,137,0,14, +259,258,257,256,255,254,253,227,139,137,0,11,13,87, +259,258,257,256,255,254,253,227,167,139,137,0,11,13,87, +173,172,0,174, +259,258,257,256,255,254,253,227,167,139,137,0,11,13,87, +168,0,169, +172,0, +261,260,259,258,257,256,255,254,253,227,225,139,137,127,0,11,13,87, +168,0,203, +172,0, +261,260,259,258,257,256,255,254,253,227,225,172,168,139,137,127,0,11,13,87, +32,25,0,37, +261,260,259,258,257,256,227,225,139,137,127,0, +259,258,257,256,227,139,137,0,14, +259,258,257,256,227,167,139,137,0,14,158,159,165,166, +259,258,257,256,227,167,139,137,0,14,158,159,165,166, +261,260,259,258,257,256,227,225,139,137,127,0,18,19, +172,168,0,200,201,202, +261,260,259,258,257,256,227,225,139,137,127,0, +255,254,253,173,172,0,11,13,87, +255,254,253,172,168,0,11,13,87, +255,254,253,172,168,0,11,13,87, +259,258,257,256,255,254,253,227,139,137,0,11,13,87, +168,0,200, +172,0, +259,258,257,256,227,139,137,0,14, +261,260,259,258,257,256,255,254,253,227,225,172,168,139,137,127,0,11,13,87, + 0 +}; + + +static unsigned const char ag_astt[2389] = { + 8,8,8,5,5,1,8,8,7,0,1,1,1,1,1,1,7,1,1,1,1,1,5,8,1,1,7,1,1,1,1,1,1,7,1,1,1, + 9,9,9,5,1,7,1,2,2,2,2,2,2,2,7,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,9,9,9,1,1,5,3,3,3,5,1,7,1,3,2,2,2,2,2,2,2,7, + 1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,1,1, + 2,1,2,2,7,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,8,7,1, + 1,1,1,1,1,1,5,7,1,1,1,1,10,10,10,10,10,10,10,10,10,10,10,5,1,1,1,8,7,1,1,1, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,1,7,1,1,1,7,1,1,1,1,1,5,1,1,7,1,1,3,1,1,10,10,10,10, + 10,10,4,4,4,10,10,4,10,10,10,4,7,1,2,7,2,7,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,7,1,1,1,1,2,2,2,2,2,2,2,7,1,10,10,3, + 7,10,3,7,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2, + 2,1,1,2,1,2,2,5,3,2,3,3,3,3,1,3,1,3,1,1,1,7,3,3,7,1,7,1,1,7,3,1,1,1,1,1,5, + 1,1,3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,7,3, + 3,7,2,7,2,2,2,2,2,2,2,7,1,1,1,1,8,8,7,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,3,3,7,3,10,10,10,10,10,10,10,10,2, + 10,10,10,7,2,2,2,2,2,2,2,7,1,1,1,1,5,5,5,7,3,1,3,1,1,1,1,1,1,1,1,1,7,1,1,1, + 1,1,1,1,1,1,1,1,7,1,1,1,1,1,8,7,1,1,1,1,1,1,1,5,7,3,1,3,1,1,1,8,7,1,1,1,1, + 1,1,1,5,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,5,7,1,3,10,10,10,10,10,10,1,1,1,10,10,10,10,10,8,5,7,1,1,1,2,2,2,2,2, + 2,2,5,1,2,2,2,7,10,10,10,10,10,10,1,1,1,10,10,10,10,10,8,7,1,1,1,9,9,9,9,9, + 9,9,9,9,5,3,7,3,7,3,7,1,1,7,3,1,1,1,1,5,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,1,1,5,5,7,1,3,1,8,7,1,10,10,10,10,10,10, + 1,1,1,10,10,10,10,10,8,7,1,1,1,1,2,7,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,5,7,3,1, + 3,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,5,5,7,3,1,3,1,1,1,1,1,1,1,1,8,1,1,7,1,1,1, + 1,1,1,1,1,1,1,1,1,1,2,7,1,1,7,2,1,1,1,1,1,1,1,5,5,7,1,1,3,3,7,3,7,1,1,7,1, + 1,1,7,3,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,2,2,2,2,2,2,2,7,1, + 9,9,9,1,1,1,1,1,1,1,5,3,3,3,3,3,3,3,3,3,3,3,1,7,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,9,9,9,9,9,9,9,5,3,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,8,7,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,8,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,8,7,1,1,2,2,2,2,1,2,2,2,7,1,2,2,2,2,2,2,2,7,1,2,2,2,2, + 2,2,2,7,1,2,2,2,2,2,2,2,7,1,10,10,10,10,10,10,10,10,2,10,10,10,7,1,1,1,5,7, + 3,1,3,10,10,10,10,10,10,10,10,10,10,10,10,1,10,1,10,1,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,2,10,7,2,2,1,1,10,10,10,10,10,10,10,10,10,10,10, + 10,1,10,1,10,1,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,2,7,2,2, + 1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,5,3,7,1,1,7,3,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,5,3,7,1,1,1,7,1,1,10,10,10,10,10,10,1,1,1,10,10,10, + 10,10,7,1,1,10,10,10,10,10,10,1,1,1,10,10,10,10,10,7,1,1,10,10,10,10,10,10, + 1,1,1,10,10,10,10,10,7,1,1,1,2,10,10,10,10,10,10,1,1,1,10,10,10,10,10,7,1, + 1,2,2,2,2,2,2,2,7,1,1,1,1,1,7,1,1,1,1,1,7,1,1,1,2,2,2,2,2,2,2,7,1,1,1,1,8, + 7,1,1,1,2,1,1,1,7,1,1,1,1,1,1,10,10,10,10,10,10,1,1,1,10,10,10,10,10,7,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,1,7, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,5,7,1,1,3,3,1,1,1,5,7,3,1,3,2,7, + 1,1,1,7,1,1,1,1,1,5,7,3,1,3,2,7,10,10,10,10,10,10,1,1,1,10,10,10,10,10,7,1, + 1,2,2,2,2,2,2,2,5,1,2,7,5,5,5,3,3,3,5,7,3,8,8,8,8,1,1,1,8,8,8,8,8,7,1,1,1, + 1,1,1,8,7,1,1,1,1,1,1,1,7,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,1,1,9,1,9,1,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,3,3,3,3,1,1,3,7,9,9,9,9,9,9,9,9,9,9,9,9,1, + 1,9,1,9,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,3,3,3,3,1,1,3,7,1,5,1,1,7, + 1,1,2,2,2,2,2,2,2,2,1,7,1,1,1,1,2,2,2,2,2,2,2,1,1,2,2,7,1,1,1,1,1,2,7,1,1, + 1,8,7,1,1,1,1,1,1,7,1,1,1,1,1,5,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1, + 7,1,1,1,1,1,7,1,1,1,1,1,8,8,1,7,1,1,1,1,1,1,8,8,8,8,1,1,1,8,8,8,8,7,1,1,1, + 10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,3,3,3,7,3,1,1,1,8,5,8,7,1,1, + 1,2,7,2,2,2,2,2,2,2,7,1,1,1,5,3,9,9,9,9,9,9,9,9,9,9,9,5,1,1,1,5,8,7,1,1,1, + 1,7,1,2,2,1,1,7,2,2,3,7,5,5,5,7,8,8,8,8,1,1,1,8,8,8,7,1,1,1,1,5,1,1,1,5,3, + 1,3,7,2,2,2,2,2,1,2,2,7,1,1,1,1,1,1,8,1,7,1,1,1,1,1,10,10,10,10,10,10,10, + 10,10,10,10,4,8,1,7,1,1,1,2,2,2,2,2,2,2,7,1,1,1,1,7,1,1,2,2,2,2,2,2,2,7,1, + 8,8,8,8,1,1,1,8,8,8,7,1,1,1,8,8,8,8,1,1,1,8,8,8,8,7,1,1,1,1,3,7,3,8,8,8,8, + 1,1,1,8,8,8,8,7,1,1,1,1,5,3,3,7,8,8,8,8,8,8,1,1,1,8,8,8,8,8,7,1,1,1,1,5,3, + 3,7,10,10,10,10,10,10,1,1,1,10,10,5,8,10,10,10,7,1,1,1,1,1,7,2,10,10,10,10, + 10,10,10,10,10,10,10,4,2,2,2,2,2,2,2,7,1,2,2,2,2,2,1,2,2,7,1,1,1,1,1,2,2,2, + 2,2,1,2,2,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,8,1,7,1,1,1,10,10,10,10, + 10,10,10,10,10,10,10,4,1,1,1,5,5,7,3,1,3,1,1,1,5,5,7,3,1,3,1,1,1,5,5,7,3,1, + 3,8,8,8,8,1,1,1,8,8,8,7,1,1,1,1,5,3,2,7,2,2,2,2,2,2,2,7,1,10,10,10,10,10, + 10,1,1,1,10,10,5,5,10,10,10,7,2,1,2,11 +}; + + +static const unsigned short ag_pstt[] = { +2,2,2,94,94,1,2,2,0,0,3,2,2, +4,4,4,1,5,4, +8,8,8,3,9,6,7,2,8,8,9,8,8, +10,3,12,12,11, +7,7,7,8, +13,5,14, +9,9,9,9,9,9,9,6,15,16, +71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71, + 71,71,71,71,71,71,71,71,7,17, +2,2,2,6,7,4,2,2,2, +96,18,9,19,98, +9,9,9,9,9,9,9,10,20, +178,178,178,178,178,178,178,178,178,181,181,181,178,24,178,21,178,22,178, + 178,178,178,178,178,178,178,10,178,178,178,178,178,178,182,23,6,178,7, + 178,178,11,27,179,27,27,27,27,23,27,11,28,27,27,26,25, +8,8,8,6,7,29,12,8,8,29,8,8, +4,4,4,30,13,30,4,30,31, +4,4,4,100,14,32,4,33,33, +10,10,10,10,10,10,10,10,10,10,10,82, +4,4,4,35,16,34,4,35, +72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72, + 72,72,72,72,72,72,72,36,17, +4,4,4,18,37,4, +8,8,8,3,6,7,19,8,8,97,8,8, +10,10,10,10,10,10,170,170,170,10,10,170,10,10,10,170,20,38, +274,21, +272,22, +85,85,85,85,85,85,85,85,87,87,87,85,85,85,85,85,85,85,85,85,85,85,85,85,85, + 85,85,85,85,85,86,85,85,85,90,23,40,39,39,40, +9,9,9,9,9,9,9,24,41, +276,275,271,25, +273,270,26, +178,178,178,178,178,178,178,178,178,181,181,181,178,24,178,21,178,22,178, + 178,178,178,178,178,178,178,10,178,178,178,178,178,178,182,23,6,178,7, + 178,178,176,175,179,175,175,175,175,23,175,11,175,26,25, +42,28,168, +5,29, +43,30, +45,44,31,108, +48,47,47,47,46,101,49,47, +99,33, +50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, + 50,50,50,50,50,77,34,80, +81,35, +70,36, +9,9,9,9,9,9,9,37,51, +4,4,4,53,53,38,52,4,53, +85,85,85,85,85,85,85,85,87,87,87,85,85,85,85,85,85,85,85,85,85,85,85,85,85, + 85,85,85,85,85,86,85,85,85,91,89, +83,40,83, +10,10,10,10,10,10,10,10,279,10,10,10,41, +9,9,9,9,9,9,9,42,54, +4,4,4,100,100,100,43,109,4,109, +55,55,55,55,55,55,55,55,55,44,56,55, +55,55,55,55,55,55,55,55,55,45,57,55, +4,4,4,30,46,30,4,30,58, +4,4,4,100,47,105,4,105, +4,4,4,30,48,30,4,30,59, +4,4,4,100,49,60,4,103, +61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61, + 61,61,61,61,61,61,61,75,50,61,78, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,63,118,51,62,4,63, +9,9,9,9,9,9,9,101,64,171, +186,169,53, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,65,54,65,4,65, +111,111,111,111,111,111,111,111,111,112, +107,56, +106,57, +148,58, +66,67,59,302, +68,68,68,46,101,68, +74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74, + 74,74,74,74,74,74,74,76, +69,70,116,116,62,71,119, +72,73,63,73, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,30,64,30,4,30,74, +173,65, +75,75,75,75,66,76, +75,75,75,75,67,77, +4,4,4,100,68,104,4,104, +4,4,4,69,78,4, +4,4,4,70,79,4, +4,4,4,100,100,71,117,4,117, +85,85,85,81,80,84,82,83,86,6,7,72,85,85,85,85,85,85,86,85,85,85,85,85,85, +129,73, +87,88,74,172, +89,89,89,89,89,89,89,307,307,75,89,89,309, +301,76, +300,77, +90,91,78,92, +93,94,79,292, +4,4,4,80,95,4, +4,4,4,81,96,4, +4,4,4,82,97,4, +4,4,4,83,98,4, +9,9,9,9,9,9,9,84,99, +124,124,124,81,80,84,82,83,6,7,126,124,124,124,124,124,124,124,124,124,124, + 124, +100,86, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, + 45,45,45,45,45,45,45,45,45,45,87,101, +40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, + 40,40,40,40,40,40,40,40,40,40,88,102, +306,306,306,306,306,306,306,308,306, +103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103, + 103,104,90,103,104, +105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105, + 105,105,106,91,105,106, +4,4,4,92,107,4, +108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108, + 108,108,108,108,108,108,108,108,108,108,108,108,108,109,108,93,108,109, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, + 110,110,110,110,110,110,110,110,110,110,110,110,110,110,111,94,110,111, +9,9,9,9,112,9,9,9,95,113, +9,9,9,9,9,9,9,96,114, +9,9,9,9,9,9,9,97,115, +9,9,9,9,9,9,9,98,116, +10,10,10,10,10,10,10,10,280,10,10,10,99, +4,4,4,100,100,128,4,128, +46,46,46,46,46,46,46,46,46,47,47,47,24,46,21,46,22,46,46,46,46,46,46,46,46, + 46,46,46,46,46,46,46,46,39,46,101,48,49,26,25, +41,41,41,41,41,41,41,41,41,42,42,42,24,41,21,41,22,41,41,41,41,41,41,41,41, + 41,41,41,41,41,41,41,41,41,38,102,43,44,26,25, +66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,68, +69,104, +61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,63, +64,106, +93,94,107,293, +56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56, + 56,56,56,56,56,56,56,56,58, +59,109, +51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51, + 51,51,51,51,51,51,51,51,53, +54,111, +4,4,4,112,117,4, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,113,118,4, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,114,119,4, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,115,120,4,121,223, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,116,122,4, +9,9,9,9,9,9,9,117,123, +69,70,124,125,118,127,126,128, +129,70,119,130,131,131, +9,9,9,9,9,9,9,120,132, +4,4,4,134,121,133,4,134,224, +136,137,137,122,137,137,137,135,135,135, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,123,138,4, +139,139,139,139,139,139,139,139,139,139,139,139,84,24,139,21,139,22,139,139, + 139,139,139,139,139,139,139,139,139,139,139,139,139,139,140,139,124,139, + 139,139,139,140,139,139,26,25, +141,141,141,141,141,141,141,141,141,141,141,141,84,24,141,21,141,22,141,141, + 141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,142,125,141, + 141,141,141,142,141,141,26,25, +4,4,4,286,126,143,4,289,289, +4,4,4,100,127,285,4,285, +283,128, +4,4,4,129,144,4, +4,4,4,100,130,310,4,310, +312,131, +10,10,10,10,10,10,4,4,4,10,10,10,10,10,132,145,4, +9,9,9,9,9,9,9,101,132, +222,134, +194,194,194,198,198,198,194,135,198, +146,146,146,146,4,4,4,146,146,146,146,146,136,146,4,146, +4,4,4,147,137,147,4,147, +69,70,124,125,138,148,148,148, +34,34,34,34,34,34,34,34,34,34,34,34,84,24,34,21,34,22,34,34,34,34,34,34,34, + 34,34,34,34,34,34,34,34,34,34,36,34,34,34,34,34,26,25, +37,140, +26,26,26,26,26,26,26,26,26,26,26,26,84,24,26,21,26,22,26,26,26,26,26,26,26, + 26,26,26,26,26,26,26,26,26,26,28,26,26,26,26,26,26,25, +29,142, +149,288, +90,91,144,150, +152,236,235,234,233,232,231,230,229,151,145,153,153,153,153,237,238, +9,9,9,9,9,154,155,9,9,146,156,157,157,158,157, +187,147, +4,4,4,159,148,159,4,159, +4,4,4,149,160,4, +4,4,4,100,150,161,4,313, +162,162,162,162,162,162,162,162,162,162,162,151,163,162, +4,4,4,152,164,4, +4,4,4,153,165,4, +4,4,4,171,166,168,154,167,4,166,170,169,171, +172,172,172,172,4,4,4,172,172,172,172,155,172,4,172, +10,10,10,10,10,10,10,10,10,10,10,199, +194,194,194,194,194,194,202,202,202,157,202, +4,4,4,173,100,173,158,173,4,173, +284,159, +9,9,9,9,9,9,9,160,174, +93,94,101,293, +14,14,14,14,14,14,14,14,14,14,14,15, +4,4,4,100,175,163,175,4,175, +176,164, +177,252,251,87,88,165,253,225, +221,166, +216,101,216,167, +178,178,178,178,4,4,4,178,178,178,168,178,4,178, +179,219, +4,4,4,218,215,4, +220,171, +9,9,9,9,9,155,9,9,172,156,157,157,158,157, +180,184,182,173,183,183,184,181,181, +10,10,10,10,10,10,10,10,10,10,10,294, +187,185,175,186,186,187, +9,9,9,9,9,9,9,176,188, +4,4,4,177,189,4, +9,9,9,9,9,9,9,178,190, +191,191,191,191,4,4,4,191,191,191,179,191,4,191, +192,192,192,192,4,4,4,192,192,192,192,180,192,4,192, +180,212,181,211, +193,193,193,193,4,4,4,193,193,193,193,182,193,4,193, +182,207,205, +208,184, +194,194,194,194,194,194,4,4,4,194,194,194,194,194,185,194,4,194, +185,249,247, +250,187, +10,10,10,10,10,10,4,4,4,10,10,100,195,10,10,10,188,195,4,195, +87,88,189,254, +10,10,10,10,10,10,10,10,10,10,10,213, +9,9,9,9,9,9,9,191,196, +9,9,9,9,9,155,9,9,192,156,157,157,197,157, +9,9,9,9,9,155,9,9,193,156,157,157,198,157, +162,162,162,162,162,162,162,162,162,162,162,194,199,162, +202,200,195,201,201,202, +10,10,10,10,10,10,10,10,10,10,10,214, +4,4,4,100,100,197,209,4,209, +4,4,4,100,100,198,203,4,203, +4,4,4,100,100,199,245,4,245, +203,203,203,203,4,4,4,203,203,203,200,203,4,203, +200,243,241, +244,202, +9,9,9,9,9,9,9,203,204, +10,10,10,10,10,10,4,4,4,10,10,100,100,10,10,10,204,239,4,239, + 0 +}; + + +static const unsigned short ag_sbt[] = { + 0, 13, 19, 32, 37, 41, 44, 54, 89, 98, 103, 112, 167, 179, + 188, 197, 209, 217, 251, 257, 269, 287, 289, 291, 331, 340, 344, 347, + 400, 403, 405, 407, 411, 419, 421, 454, 456, 458, 467, 476, 512, 515, + 528, 537, 547, 559, 571, 580, 588, 597, 605, 641, 661, 671, 674, 693, + 703, 705, 707, 709, 713, 719, 752, 759, 763, 783, 785, 791, 797, 805, + 811, 817, 826, 851, 853, 857, 870, 872, 874, 878, 882, 888, 894, 900, + 906, 915, 937, 939, 976,1013,1022,1046,1071,1077,1114,1151,1161,1170, + 1179,1188,1201,1209,1249,1289,1310,1312,1334,1336,1340,1374,1376,1410, + 1412,1418,1435,1452,1471,1488,1497,1505,1511,1520,1529,1539,1556,1602, + 1648,1657,1665,1667,1673,1681,1683,1700,1709,1711,1720,1736,1744,1752, + 1795,1797,1840,1842,1844,1848,1865,1880,1882,1890,1896,1904,1918,1924, + 1930,1943,1958,1970,1981,1991,1993,2002,2006,2018,2027,2029,2037,2039, + 2043,2057,2059,2065,2067,2081,2090,2102,2108,2117,2123,2132,2146,2161, + 2165,2180,2183,2185,2203,2206,2208,2228,2232,2244,2253,2267,2281,2295, + 2301,2313,2322,2331,2340,2354,2357,2359,2368,2388 +}; + + +static const unsigned short ag_sbe[] = { + 8, 16, 26, 33, 40, 42, 51, 87, 94, 100, 110, 152, 173, 183, + 192, 208, 213, 250, 254, 263, 285, 288, 290, 326, 338, 343, 346, 387, + 401, 404, 406, 409, 416, 420, 452, 455, 457, 465, 472, 510, 513, 527, + 535, 543, 556, 568, 575, 584, 592, 601, 638, 657, 668, 673, 689, 702, + 704, 706, 708, 711, 717, 751, 756, 761, 778, 784, 789, 795, 801, 808, + 814, 822, 837, 852, 855, 866, 871, 873, 876, 880, 885, 891, 897, 903, + 913, 925, 938, 974,1011,1020,1043,1068,1074,1111,1148,1159,1168,1177, + 1186,1200,1205,1244,1284,1309,1311,1333,1335,1338,1373,1375,1409,1411, + 1415,1432,1449,1466,1485,1495,1501,1507,1518,1524,1532,1553,1592,1638, + 1652,1661,1666,1670,1677,1682,1697,1707,1710,1718,1732,1740,1748,1787, + 1796,1832,1841,1843,1846,1858,1874,1881,1886,1893,1900,1915,1921,1927, + 1936,1954,1969,1979,1987,1992,2000,2004,2017,2023,2028,2034,2038,2042, + 2053,2058,2062,2066,2075,2084,2101,2104,2115,2120,2130,2142,2157,2163, + 2176,2181,2184,2199,2204,2207,2224,2230,2243,2251,2261,2275,2292,2297, + 2312,2318,2327,2336,2350,2355,2358,2366,2384,2388 +}; + + +static const unsigned char ag_fl[] = { + 1,1,2,0,1,4,1,2,1,1,2,1,3,1,2,1,2,1,2,0,1,2,1,1,1,1,2,0,1,3,1,1,1,1,2, + 0,1,3,3,3,0,2,2,2,2,0,2,2,2,2,1,2,0,1,3,1,2,0,1,3,1,2,0,1,3,1,2,0,1,3, + 4,0,2,1,2,0,1,0,2,0,2,4,1,3,1,1,1,1,1,2,0,1,1,1,0,1,0,2,3,5,0,1,1,3,5, + 3,3,3,3,3,1,2,1,1,1,1,0,2,0,2,1,1,1,1,2,0,1,0,4,6,1,1,1,1,1,1,0,1,2,1, + 1,1,1,1,2,0,1,1,3,1,1,1,2,1,2,0,1,2,1,1,1,2,1,2,3,3,1,1,3,5,0,3,3,4,1, + 2,1,1,1,1,1,1,1,1,1,1,5,7,1,1,1,1,1,1,0,1,1,1,2,1,1,1,2,4,1,2,0,1,6,4, + 1,2,6,3,4,2,1,0,1,1,5,5,6,1,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,2,0,1,7, + 4,1,2,0,1,5,1,1,1,3,1,1,7,1,2,0,1,7,4,1,2,0,1,2,1,2,2,2,2,2,2,2,1,1,3, + 3,1,1,6,9,2,0,1,1,2,1,1,3,5,4,0,2,6,2,2,3,3,3,1,1,1,2,0,1,2,2,1,6,4 +}; + +static const unsigned short ag_ptt[] = { + 0, 8, 8, 9, 9, 4, 13, 13, 11, 14, 14, 17, 17, 19, 19, 18, 21, 22, + 22, 23, 23, 20, 29, 29, 29, 30, 30, 31, 31, 24, 34, 34, 34, 35, 35, 36, + 36, 24, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 46, 46, 47, 47, + 44, 49, 49, 50, 50, 44, 53, 53, 54, 54, 51, 56, 56, 57, 57, 51, 58, 60, + 60, 67, 67, 68, 68, 69, 69, 70, 70, 63, 65, 71, 72, 77, 77, 77, 78, 78, + 79, 79, 73, 74, 81, 81, 83, 83, 5, 80, 87, 87, 86, 86, 86, 86, 93, 93, + 85, 91, 96, 96, 92, 7, 7, 7, 99, 99,100,100,103,103,103,104,104,105, + 105,107,107, 82,102,102,102,102,102,102,114,114,112,117,117,117,117,118, + 118,119,119,115, 89, 89, 89, 89,129,130,130,131,131,125,126,126,126,132, + 138,138,133,134,128, 6, 6,141,145,145,146,143,149,149,142,148,148,148, + 148,148,148,148,148,148,140,108,153,153,153,153,160,160,164,164,164,164, + 157,166,166,166,165,169,170,170,171,171,158,174,175,175,159,177,177,178, + 178,179,179,179,156,156,109,182,182,183,184,184,184,186,187,187,187,187, + 187,187,187,188,188,200,201,201,202,202,197,203,204,204,205,205,198,185, + 185,185,185,116,116,209,215,215,216,216,210,218,219,219,220,220,214,217, + 41, 41,221,221,223,223,223, 28, 28, 42, 27,110,110,230,231,233,236,236, + 236,233,234,234, 98, 98,235,240,240,113,241,242,245,245, 88,247,247,248, + 248,249,249,244,252,252,111,251 +}; + + +static void ag_ra(PCB_DECL) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: VNO AG_WRAP_5(ag_rp_1(PCB_POINTER, V(0,(int *)))); break; + case 2: VRO(AG_WRAP_5 *, ag_rp_2(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 3: VWD(0,AG_WRAP_5 *); break; + case 4: VWD(2,AG_WRAP_5 *); break; + case 5: VNO AG_WRAP_5(ag_rp_3(PCB_POINTER, VW(1, AG_WRAP_5 *))); + VWD(1, AG_WRAP_5 *); break; + case 6: VNO AG_WRAP_5(ag_rp_4(PCB_POINTER, VW(1, AG_WRAP_5 *))); + VWD(1, AG_WRAP_5 *); break; + case 7: VNO AG_WRAP_5(ag_rp_5(PCB_POINTER)); break; + case 8: VRO(AG_WRAP_5 *, ag_rp_6(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 9: VRO(AG_WRAP_5 *, ag_rp_7(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 10: VRO(AG_WRAP_5 *, ag_rp_8(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 11: VRO(AG_WRAP_5 *, ag_rp_9(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 12: VNO AG_WRAP_5(ag_rp_10(PCB_POINTER)); break; + case 13: VRO(AG_WRAP_5 *, ag_rp_11(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 14: VRO(AG_WRAP_5 *, ag_rp_12(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 15: VRO(AG_WRAP_5 *, ag_rp_13(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 16: VRO(AG_WRAP_5 *, ag_rp_14(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 17: ag_rp_15(PCB_POINTER, VW(1, AG_WRAP_5 *)); + VWD(1, AG_WRAP_5 *); break; + case 18: VNO AG_WRAP_5(ag_rp_16(PCB_POINTER)); break; + case 19: VRO(AG_WRAP_5 *, ag_rp_17(PCB_POINTER, VW(0, AG_WRAP_5 *), V(1,(int *)))); break; + case 20: ag_rp_18(PCB_POINTER, V(0,(int *))); break; + case 21: ag_rp_19(PCB_POINTER); break; + case 22: ag_rp_20(PCB_POINTER, V(0,(int *))); break; + case 23: ag_rp_21(PCB_POINTER, VW(2, AG_WRAP_5 *)); + VWD(2, AG_WRAP_5 *); break; + case 24: ag_rp_22(PCB_POINTER, VW(1, AG_WRAP_5 *), VW(2, AG_WRAP_6 *)); + VWD(1, AG_WRAP_5 *); VWD(2, AG_WRAP_6 *); break; + case 25: VNO AG_WRAP_6(ag_rp_23(PCB_POINTER)); break; + case 26: VRO(AG_WRAP_6 *, ag_rp_24(PCB_POINTER, VW(0, AG_WRAP_6 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 27: VRO(AG_WRAP_5 *, ag_rp_25(PCB_POINTER, VW(0, AG_WRAP_5 *), VW(2, AG_WRAP_5 *))); + VWD(2, AG_WRAP_5 *); break; + case 28: ag_rp_26(PCB_POINTER, VW(1, AG_WRAP_5 *)); + VWD(1, AG_WRAP_5 *); break; + case 29: ag_rp_27(PCB_POINTER, V(0,(int *))); break; + case 30: ag_rp_28(PCB_POINTER, V(0,(int *))); break; + case 31: ag_rp_29(PCB_POINTER, V(0,(int *))); break; + case 32: ag_rp_30(PCB_POINTER); break; + case 33: ag_rp_31(PCB_POINTER, VW(1, AG_WRAP_5 *), VW(2, AG_WRAP_6 *)); + VWD(1, AG_WRAP_5 *); VWD(2, AG_WRAP_6 *); break; + case 34: VWD(3,AG_WRAP_5 *); break; + case 35: ag_rp_32(PCB_POINTER, VW(2, AG_WRAP_5 *), VW(3, AG_WRAP_8 *)); + VWD(2, AG_WRAP_5 *); VWD(3, AG_WRAP_8 *); break; + case 36: VRO(AG_WRAP_7 *, ag_rp_33(PCB_POINTER, VW(0, AG_WRAP_7 *))); break; + case 37: VRO(AG_WRAP_8 *, ag_rp_34(PCB_POINTER, VW(0, AG_WRAP_8 *), VW(1, AG_WRAP_7 *))); + VWD(1, AG_WRAP_7 *); break; + case 38: VNO AG_WRAP_7(ag_rp_35(PCB_POINTER, VW(1, AG_WRAP_5 *), V(3,(Attribute::Type *)), VW(5, AG_WRAP_9 *))); + VWD(1, AG_WRAP_5 *); VWD(5, AG_WRAP_9 *); break; + case 39: V(0,(Attribute::Type *)) = ag_rp_36(PCB_POINTER); break; + case 40: V(0,(Attribute::Type *)) = ag_rp_37(PCB_POINTER); break; + case 41: V(0,(Attribute::Type *)) = ag_rp_38(PCB_POINTER); break; + case 42: V(0,(Attribute::Type *)) = ag_rp_39(PCB_POINTER); break; + case 43: V(0,(Attribute::Type *)) = ag_rp_40(PCB_POINTER); break; + case 44: V(0,(Attribute::Type *)) = ag_rp_41(PCB_POINTER); break; + case 45: V(0,(Attribute::Type *)) = ag_rp_42(PCB_POINTER); break; + case 46: V(0,(Attribute::Type *)) = ag_rp_43(PCB_POINTER); break; + case 47: V(0,(Attribute::Type *)) = ag_rp_44(PCB_POINTER); break; + case 48: V(0,(Attribute::Type *)) = ag_rp_45(PCB_POINTER); break; + case 49: VNO AG_WRAP_9(ag_rp_46(PCB_POINTER)); break; + case 50: VNO AG_WRAP_9(ag_rp_47(PCB_POINTER)); break; + case 51: VRO(AG_WRAP_5 *, ag_rp_48(PCB_POINTER, VW(0, AG_WRAP_5 *))); break; + case 52: VNO AG_WRAP_9(ag_rp_49(PCB_POINTER, VW(2, AG_WRAP_5 *))); + VWD(2, AG_WRAP_5 *); break; + case 53: V(0,(int *)) = ag_rp_50(PCB_POINTER, V(1,(int *))); break; + case 54: V(0,(int *)) = ag_rp_51(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 55: V(0,(int *)) = ag_rp_52(PCB_POINTER, V(1,(int *))); break; + case 56: V(0,(int *)) = ag_rp_53(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 57: V(0,(int *)) = ag_rp_54(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 58: V(0,(int *)) = ag_rp_55(PCB_POINTER, VW(1, AG_WRAP_5 *)); + VWD(1, AG_WRAP_5 *); break; + case 59: VWD(1,AG_WRAP_5 *); break; + case 60: VWD(4,AG_WRAP_5 *); break; + } +} + +#define TOKEN_NAMES parse_token_names +const char *const parse_token_names[265] = { + "document", + "\"--\"", + "\"?>\"", + "\"]]>\"", + "document", + "prolog", + "element", + "Misc", + "", + "", + "eof", + "S", + "SpaceChar", + "", + "Name", + "", + "NameChar", + "Names", + "Nmtoken", + "", + "Nmtokens", + "", + "", + "", + "EntityValue", + "'\\\"'", + "", + "PEReference", + "Reference", + "", + "", + "", + "'\\''", + "", + "", + "", + "", + "AttValue", + "dq AttValString", + "sq AttValString", + "", + "CharRef", + "EntityRef", + "", + "SystemLiteral", + "", + "", + "", + "", + "", + "", + "PubidLiteral", + "PubidChar", + "", + "", + "", + "", + "", + "Comment", + "\"<!--\"", + "comment text", + "'>'", + "Char", + "PI", + "\"<?\"", + "PITarget", + "", + "", + "", + "", + "", + "CDSect", + "CDStart", + "CData", + "CDEnd", + "\"<![CDATA[\"", + "\"\\r\\n\"", + "", + "", + "", + "XMLDecl", + "", + "doctypedecl", + "", + "\"<?xml\"", + "VersionInfo", + "VersionDecl", + "", + "EncodingDecl", + "SDDecl", + "\"version\"", + "Eq", + "VersionNum", + "", + "'='", + "", + "", + "\"<!DOCTYPE\"", + "ExternalID", + "", + "", + "'['", + "markupdecl", + "", + "", + "", + "']'", + "", + "elementdecl", + "AttlistDecl", + "EntityDecl", + "NotationDecl", + "extSubset", + "TextDecl", + "", + "extSubsetDecl", + "conditionalSect", + "", + "", + "", + "\"standalone\"", + "\"\\'yes\\'\"", + "\"\\\"yes\\\"\"", + "\"\\'no\\'\"", + "\"\\\"no\\\"\"", + "LanguageId", + "Langcode", + "'-'", + "Subcode", + "", + "", + "", + "ISO639Code", + "IanaCode", + "UserCode", + "", + "", + "", + "", + "", + "EmptyElementTag", + "STag", + "content", + "ETag", + "'<'", + "AttributeList", + "Attribute", + "\"</\"", + "content unit", + "", + "", + "\"/>\"", + "\"<!ELEMENT\"", + "contentspec", + "\"EMPTY\"", + "\"ANY\"", + "Mixed", + "Children", + "choice", + "seq", + "", + "'\\?'", + "'*'", + "'+'", + "", + "cp", + "", + "'('", + "'|'", + "", + "", + "", + "')'", + "','", + "", + "", + "\"#PCDATA\"", + "", + "", + "", + "\")*\"", + "\"<!ATTLIST\"", + "AttDefs", + "AttDef", + "AttType", + "DefaultDecl", + "StringType", + "TokenizedType", + "EnumeratedType", + "\"CDATA\"", + "\"ID\"", + "\"IDREF\"", + "\"IDREFS\"", + "\"ENTITY\"", + "\"ENTITIES\"", + "\"NMTOKEN\"", + "\"NMTOKENS\"", + "NotationType", + "Enumeration", + "\"NOTATION\"", + "", + "", + "", + "", + "", + "", + "\"#REQUIRED\"", + "\"#IMPLIED\"", + "\"#FIXED\"", + "includeSect", + "ignoreSect", + "\"<![\"", + "\"INCLUDE\"", + "\"IGNORE\"", + "ignoreSectContents", + "", + "", + "Ignore", + "", + "", + "", + "decimal CharRef", + "';'", + "hex CharRef", + "\"&#\"", + "", + "\"&#x\"", + "", + "'&'", + "'%'", + "GEDecl", + "PEDecl", + "\"<!ENTITY\"", + "EntityDef", + "PEDef", + "NDataDecl", + "", + "\"SYSTEM\"", + "\"PUBLIC\"", + "\"NDATA\"", + "", + "extParsedEnt", + "extPE", + "\"encoding\"", + "EncName", + "", + "", + "", + "", + "", + "\"<!NOTATION\"", + "PublicID", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + +}; + +#ifndef MISSING_FORMAT +#define MISSING_FORMAT "Missing %s" +#endif +#ifndef UNEXPECTED_FORMAT +#define UNEXPECTED_FORMAT "Unexpected %s" +#endif +#ifndef UNNAMED_TOKEN +#define UNNAMED_TOKEN "input" +#endif + + +static void ag_diagnose(PCB_DECL) { + int ag_snd = (PCB).sn; + int ag_k = ag_sbt[ag_snd]; + + if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 + && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 + && *TOKEN_NAMES[ag_tstt[ag_k]]) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); + } + else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') { + char buf[20]; + sprintf(buf, "\'%c\'", (char) (*(PCB).lab)); + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); + } + else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); + (PCB).error_message = (PCB).ag_msg; + + +} +static int ag_action_1_r_proc(PCB_DECL); +static int ag_action_2_r_proc(PCB_DECL); +static int ag_action_3_r_proc(PCB_DECL); +static int ag_action_4_r_proc(PCB_DECL); +static int ag_action_1_s_proc(PCB_DECL); +static int ag_action_3_s_proc(PCB_DECL); +static int ag_action_1_proc(PCB_DECL); +static int ag_action_2_proc(PCB_DECL); +static int ag_action_3_proc(PCB_DECL); +static int ag_action_4_proc(PCB_DECL); +static int ag_action_5_proc(PCB_DECL); +static int ag_action_6_proc(PCB_DECL); +static int ag_action_7_proc(PCB_DECL); +static int ag_action_8_proc(PCB_DECL); +static int ag_action_9_proc(PCB_DECL); +static int ag_action_10_proc(PCB_DECL); +static int ag_action_11_proc(PCB_DECL); +static int ag_action_8_proc(PCB_DECL); + + +static int (*const ag_r_procs_scan[])(PCB_DECL) = { + ag_action_1_r_proc, + ag_action_2_r_proc, + ag_action_3_r_proc, + ag_action_4_r_proc +}; + +static int (*const ag_s_procs_scan[])(PCB_DECL) = { + ag_action_1_s_proc, + ag_action_2_r_proc, + ag_action_3_s_proc, + ag_action_4_r_proc +}; + +static int (*const ag_gt_procs_scan[])(PCB_DECL) = { + ag_action_1_proc, + ag_action_2_proc, + ag_action_3_proc, + ag_action_4_proc, + ag_action_5_proc, + ag_action_6_proc, + ag_action_7_proc, + ag_action_8_proc, + ag_action_9_proc, + ag_action_10_proc, + ag_action_11_proc, + ag_action_8_proc +}; + + +static int ag_action_10_proc(PCB_DECL) { + (PCB).btsx = 0, (PCB).drt = -1; + ag_track(PCB_POINTER); + return 0; +} + +static int ag_action_11_proc(PCB_DECL) { + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + (PCB).ssx--; + ag_ra(PCB_POINTER); + (PCB).ssx++; + ag_track(PCB_POINTER); + return 0; +} + +static int ag_action_3_r_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_3_s_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_4_r_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + return 1; +} + +static int ag_action_2_proc(PCB_DECL) { + (PCB).btsx = 0, (PCB).drt = -1; + if ((PCB).ssx >= 128) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + } + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + ag_track(PCB_POINTER); + return 0; +} + +static int ag_action_9_proc(PCB_DECL) { + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + ag_prot(PCB_POINTER); + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + (PCB).rx = 0; + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_2_r_proc(PCB_DECL) { + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + return 0; +} + +static int ag_action_7_proc(PCB_DECL) { + --(PCB).ssx; + (PCB).exit_flag = AG_SUCCESS_CODE; + (PCB).rx = 0; + return 0; +} + +static int ag_action_1_proc(PCB_DECL) { + (PCB).exit_flag = AG_SUCCESS_CODE; + ag_track(PCB_POINTER); + return 0; +} + +static int ag_action_1_r_proc(PCB_DECL) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_s_proc(PCB_DECL) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_4_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return 0; +} + +static int ag_action_3_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(PCB_POINTER); + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return 0; +} + +static int ag_action_8_proc(PCB_DECL) { + ag_undo(PCB_POINTER); + (PCB).rx = 0; + (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; + ag_diagnose(PCB_POINTER); + SYNTAX_ERROR; + {(PCB).rx = 1; ag_track(PCB_POINTER);} + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_5_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else { + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).rx = 0; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_6_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).reduction_token = (parse_token_type) ag_ptt[(PCB).ag_ap]; + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + if (ag_sd) { + (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + } + else { + ag_prot(PCB_POINTER); + (PCB).vs[(PCB).ssx] = ag_null_value; + GET_CONTEXT; + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).rx = 0; + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + + +void init_parse(parse_pcb_type *PCB_POINTER) { + unsigned ag_t1; + ag_t1 = 0; + (PCB).rx = (PCB).fx = 0; + (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; + (PCB).exit_flag = AG_RUNNING_CODE; + (PCB).key_sp = NULL; + (PCB).key_state = 0; + (PCB).line = FIRST_LINE; + (PCB).column = FIRST_COLUMN; + (PCB).btsx = 0, (PCB).drt = -1; + while (ag_tstt[ag_t1] == 0) { + (PCB).ag_ap = ag_pstt[ag_t1]; + (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER); + ag_t1 = ag_sbt[(PCB).sn]; + } +} + +void parse(parse_pcb_type *PCB_POINTER) { + (PCB).lab[(PCB).fx++] = (PCB).input_code; + while ((PCB).exit_flag == AG_RUNNING_CODE) { + while (1) { + const unsigned char *ag_p; + int ag_ch; + if ((PCB).rx >= (PCB).fx) return; + ag_ch = CONVERT_CASE((PCB).lab[(PCB).rx++]); + if ((PCB).key_sp) { + if (ag_ch != *(PCB).key_sp++) { + (PCB).rx = (PCB).save_index; + (PCB).key_sp = NULL; + (PCB).key_state = 0; + break; + } else if (*(PCB).key_sp) continue; + if (ag_key_act[(PCB).key_state] == ag_cf_end_key) { + int ag_k1; + int ag_k2; + if ((PCB).rx >= (PCB).fx) { + (PCB).rx--; + (PCB).key_sp--; + return; + } + (PCB).key_sp = NULL; + ag_k1 = ag_key_parm[(PCB).key_state]; + ag_k2 = ag_key_pt[ag_k1]; + if (ag_key_itt[ag_k2 + CONVERT_CASE((PCB).lab[(PCB).rx])]) + (PCB).rx = (PCB).save_index; + else { + (PCB).token_number = (parse_token_type) ag_key_pt[ag_k1+1]; + (PCB).key_state = 0; + } + break; + } + else { + (PCB).token_number = (parse_token_type) ag_key_parm[(PCB).key_state]; + (PCB).key_state = 0; + (PCB).key_sp = NULL; + } + break; + } + if ((PCB).key_state == 0) { + (PCB).token_number = (parse_token_type) AG_TCV(ag_ch); + if (((PCB).key_state = ag_key_index[(PCB).sn]) == 0) break; + (PCB).save_index = 1; + } + ag_p = &ag_key_ch[(PCB).key_state]; + if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++; + if (*ag_p == ag_ch) { + (PCB).key_state = (int)(ag_p - ag_key_ch); + switch (ag_key_act[(PCB).key_state]) { + case ag_cf_set_key: { + int ag_k1; + int ag_k2; + if ((PCB).rx >= (PCB).fx) { + (PCB).rx--; + return; + } + ag_k1 = ag_key_parm[(PCB).key_state]; + ag_k2 = ag_key_pt[ag_k1]; + (PCB).key_state = ag_key_jmp[(PCB).key_state]; + if (ag_key_itt[ag_k2 + CONVERT_CASE((PCB).lab[(PCB).rx])]) continue; + (PCB).save_index = (PCB).rx; + (PCB).token_number = (parse_token_type) ag_key_pt[ag_k1+1]; + continue; + } + case ag_set_key: + (PCB).save_index = (PCB).rx; + (PCB).token_number = (parse_token_type) ag_key_parm[(PCB).key_state]; + case ag_jmp_key: + (PCB).key_state = ag_key_jmp[(PCB).key_state]; + continue; + case ag_cf_end_key: + case ag_end_key: + (PCB).key_sp = ag_key_ends + ag_key_jmp[(PCB).key_state]; + continue; + case ag_accept_key: + (PCB).token_number = (parse_token_type) ag_key_parm[(PCB).key_state]; + (PCB).key_state = 0; + break; + case ag_cf_accept_key: { + int ag_k1; + int ag_k2; + if ((PCB).rx >= (PCB).fx) { + (PCB).rx--; + return; + } + ag_k1 = ag_key_parm[(PCB).key_state]; + ag_k2 = ag_key_pt[ag_k1]; + if (ag_key_itt[ag_k2 + CONVERT_CASE((PCB).lab[(PCB).rx])]) + (PCB).rx = (PCB).save_index; + else { + (PCB).token_number = (parse_token_type) ag_key_pt[ag_k1+1]; + (PCB).key_state = 0; + } + break; + } + } + break; + } else { + (PCB).rx = (PCB).save_index; + (PCB).key_state = 0; + break; + } + } + + { + unsigned ag_t1 = ag_sbt[(PCB).sn]; + unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] > (unsigned short)(PCB).token_number) + ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + if (ag_tstt[ag_t1] != (PCB).token_number) ag_t1 = ag_sbe[(PCB).sn]; + (PCB).ag_ap = ag_pstt[ag_t1]; + (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER); + } + } +} + +