123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /*
- * @OSF_COPYRIGHT@
- * COPYRIGHT NOTICE
- * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
- * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
- * the full copyright text.
- */
- /*
- * HISTORY
- */
- #ifdef REV_INFO
- #ifndef lint
- static char rcsid[] = "$TOG: UilLexAna.c /main/14 1997/03/12 15:10:52 dbl $"
- #endif
- #endif
- /*
- * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
- /*
- **++
- ** FACILITY:
- **
- ** User Interface Language Compiler (UIL)
- **
- ** ABSTRACT:
- **
- ** This module hold the routines that build tokens for the UIL
- ** compiler.
- **
- **--
- **/
- /*
- **
- ** INCLUDE FILES
- **
- **/
- #include <Xm/Xm.h>
- /* I think this one should be public too, it's not the case right now,
- and I don't want to include XmP.h here - dd */
- extern char *_XmStringGetCurrentCharset ();
- #include <Xm/XmosP.h> /* Need this for MB_CUR_MAX */
- #include <Mrm/MrmosI.h> /* Need this for _MrmOSSetLocale. */
- #include "UilDefI.h"
- #include <ctype.h>
- double atof();
- #include <errno.h> /* needed to support conversion functions */
- #ifdef X_NOT_STDC_ENV
- extern int errno;
- #endif
- /*
- **
- ** TABLE OF CONTENTS
- **
- */
- /*
- ** FORWARD DECLARATIONS
- */
- typedef struct _lex_buffer_type
- {
- struct _lex_buffer_type *az_next_buffer;
- unsigned char c_text[ 1 ];
- } lex_buffer_type;
- static lex_buffer_type *get_lex_buffer _ARGUMENTS(( lex_buffer_type *az_current_lex_buffer ));
- #if debug_version
- static void dump_token _ARGUMENTS(( lex_buffer_type *az_current_lex_buffer , int l_lex_pos ));
- #endif
- /*
- **
- ** EXTERNAL DEFINITIONS
- **
- */
- /* These values are set by Lex initiailize routine or if the charset */
- /* option is specified on the module declaration */
- externaldef(uil_comp_glbl) int Uil_lex_l_user_default_charset;
- externaldef(uil_comp_glbl) sym_value_entry_type *Uil_lex_az_charset_entry;
- externaldef(uil_comp_glbl) int Uil_lex_l_localized;
-
- /* This is the most recent character set recognized by the grammar. It */
- /* allows the use of the CHARACTER_SET function to prefix general string */
- /* literals. */
- externaldef(uil_comp_glbl) int Uil_lex_l_charset_specified;
- externaldef(uil_comp_glbl) int Uil_lex_l_literal_charset;
- externaldef(uil_comp_glbl) sym_value_entry_type *Uil_lex_az_literal_charset;
- /* %COMPLETE */
- externaldef(uil_comp_glbl) int Uil_characters_read;
- /* For portability, declare all yy* variables as extern. */
- extern yystype yylval;
- extern yystype prev_yylval;
- /* This stack entry is used as the result of epsilon productions. */
- extern yystype gz_yynullval;
- /*
- * Retain comments as scanned
- */
- #define INITIAL_COMMENT_SIZE 8000
- #define INCR_COMMENT_SIZE 2000
- externaldef(uil_comp_glbl) char *comment_text;
- externaldef(uil_comp_glbl) int comment_size;
- static int last_token_seen = 0;
- /*
- **
- ** MACRO DEFINITIONS
- **
- **/
- /*
- ** Each of the 256 possible input characters has an associated class.
- ** These defines gives names to the classes.
- */
- #define class_blank 0 /* white space */
- #define class_punc 1 /* punctuation characters */
- #define class_name 2 /* alphabetics - {eEntvbrf} + {$ _} */
- #define class_e 3 /* e */
- #define class_escape 4 /* n t v b r f */
- #define class_ff 5 /* form feed */
- #define class_digit 6 /* 0..9 */
- #define class_dot 7 /* . */
- #define class_sign 8 /* - + */
- #define class_quote 9 /* ' */
- #define class_bslash 10 /* \ */
- #define class_slash 11 /* / */
- #define class_star 12 /* * */
- #define class_exclam 13 /* ! */
- #define class_eol 14 /* end of line - ascii nul */
- #define class_rest 15 /* remaining printable characters */
- #define class_illegal 16 /* remaining non printable characters */
- #define class_pound 17 /* # */
- #define class_dquote 18 /* " */
- #define class_langle 19 /* < */
- #define class_rangle 20 /* > */
- #define class_highbit 21 /* high order bit set */
- #define max_class 21
- /*
- ** states within the token table
- */
- #define state_initial 0 /* initial state of automaton */
- #define state_name 1 /* looking for a name */
- #define state_integer 2 /* looking for a integer */
- #define state_real_1 3 /* looking for a real */
- #define state_real_2 4 /* looking for a real */
- #define state_exp_1 5 /* looking for a real with exponent */
- #define state_exp_2 6 /* looking for a real with exponent */
- #define state_exp_3 7 /* looking for a real with exponent */
- #define state_str_1 8 /* looking for a string */
- #define state_str_2 9 /* looking for a string */
- #define state_str_3 10 /* looking for a string */
- #define state_comment_1 11 /* looking for a comment */
- #define state_comment_2 12 /* looking for a comment */
- #define state_comment_3 13 /* looking for a comment */
- #define state_comment_4 14 /* looking for a comment */
- #define state_eat_rest 15 /* eat up rest characters */
- #define state_gstr_1 16 /* looking for a general string */
- #define state_gstr_2 17 /* looking for a general string */
- #define state_gstr_3 18 /* looking for a general string */
- #define state_gstr_4 19 /* looking for a general string */
- #define state_gstr_5 20 /* looking for a general string */
- #define state_langle 21 /* looking for << */
- #define state_rangle 22 /* looking for >> */
- #define max_state 22
- /*
- ** actions in token table
- ** all actions requiring a move of the current character have
- ** a negative value
- */
- #define NEGATIVE 0x40
- #define min_action 1
- #define move_advance (NEGATIVE | 1) /* save character - goto next state */
- #define advance 1 /* goto next state */
- #define move_final (NEGATIVE | 2) /* save character - found token */
- #define final 2 /* found token */
- #define move_error (NEGATIVE | 3) /* save character - found error */
- #define error 3 /* found error */
- #define move_special (NEGATIVE | 4) /* special action */
- #define special 4 /* save character - special action */
- #define reset 5 /* reset the analyzer */
- #define final_comment (NEGATIVE | 6) /* save whole comment RAP */
- /*
- ** errors encoded in the token table
- */
- #define min_error 0
- #define bad_prefix 0 /* junk starts a token */
- #define error_max 0
- /*
- ** final states in the token table
- */
- #define token_min 1
- #define token_punc 1 /* punctuation character */
- #define token_eol 2 /* end of line */
- #define token_real 3 /* real number */
- #define token_integer 4 /* integer */
- #define token_name 5 /* identifier */
- #define token_ustring 6 /* unterminated string */
- #define token_string 7 /* string */
- #define token_ff 8 /* form feed */
- #define token_ugstr 9 /* unterminated general string */
- #define token_gstr 10 /* general string */
- #define token_punc2 11 /* 2 character punctuation */
- #define token_comment 12 /* comment block RAP */
- #define token_lstr 13 /* localized general string */
- #define token_max 13
- /*
- ** special actions that take place
- */
- #define control_char 1 /* unprintable character in construct */
- #define start_bslash 2 /* start of \ construct in string */
- #define ignore_bslash 3 /* \ not followed by correct sequence */
- #define found_digit 4 /* digit in \ sequence */
- #define end_digits 5 /* end of \digit...\ sequence */
- #define insert_char 6 /* end of \x sequence */
- #define missing_bslash 7 /* \ at end of \digit...\ missing */
- #define string_wrap 8 /* string wraps to next line */
- #define comment_wrap 9 /* comment wraps to next line */
- #define charset_gstr 10 /* found char set for general string */
- #define nocharset_gstr 11 /* default char set for general string */
- #define highbit_char 12 /* default char set for general string */
- /*
- ** define backup field values of a token table cell
- */
- #define not_used 0 /* value not defined for this action */
- #define backup_0 0 /* no backup required */
- #define backup_1 1 /* 1 character backup needed */
- #define backup_2 2 /* 2 character backup needed */
- #define backup_3 3 /* 3 character backup needed */
- /*
- ** form of each cell in the token table
- */
- typedef struct
- {
- char action; /* action to be taken */
- char next_state; /* next state */
- /* terminal found */
- /* error found */
- char backup; /* number of character to backup */
- /* action for special cases */
- char unused;
- } cell;
- /*
- **
- ** OWN Storage for TOKEN BUILDER
- **
- */
- #define l_max_lex_buffer_pos 127
- static lex_buffer_type *az_first_lex_buffer;
- /*
- ** the actual token table
- */
- static cell XmConst token_table[ max_state+1][ max_class+1] =
- {
- { /* state_initial */
- /* class_blank */ { reset, state_initial, not_used },
- /* class_punc */ { move_final, token_punc, backup_0 },
- /* class_name */ { move_advance, state_name, not_used },
- /* class_e */ { move_advance, state_name, not_used },
- /* class_escape */ { move_advance, state_name, not_used },
- /* class_ff */ { final, token_ff, backup_0 },
- /* class_digit */ { move_advance, state_integer, not_used },
- /* class_dot */ { move_advance, state_real_1, not_used },
- /* class_sign */ { move_final, token_punc, backup_0 },
- /* class_quote */ { advance, state_str_1, not_used },
- /* class_bslash */ { move_advance, state_eat_rest, not_used },
- /* class_slash */ { move_advance, state_comment_1, not_used },
- /* class_star */ { move_final, token_punc, backup_0 },
- /* class_exclam */ { move_advance, state_comment_4, not_used },
- /* class_eol */ { final, token_eol, backup_0 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_initial, control_char },
- /* class_pound */ { move_final, token_punc, backup_0 },
- /* class_dquote */ { special, state_gstr_3, nocharset_gstr },
- /* class_langle */ { move_advance, state_langle, not_used },
- /* class_rangle */ { move_advance, state_rangle, not_used },
- /* class_highbit */ { move_advance, state_eat_rest, not_used },
- },
- { /* state_name */
- /* class_blank */ { final, token_name, backup_0 },
- /* class_punc */ { move_final, token_name, backup_1 },
- /* class_name */ { move_advance, state_name, not_used },
- /* class_e */ { move_advance, state_name, not_used },
- /* class_escape */ { move_advance, state_name, not_used },
- /* class_ff */ { move_final, token_name, backup_1 },
- /* class_digit */ { move_advance, state_name, not_used },
- /* class_dot */ { move_final, token_name, backup_1 },
- /* class_sign */ { move_final, token_name, backup_1 },
- /* class_quote */ { move_final, token_name, backup_1 },
- /* class_bslash */ { move_final, token_name, backup_1 },
- /* class_slash */ { move_final, token_name, backup_1 },
- /* class_star */ { move_final, token_name, backup_1 },
- /* class_exclam */ { move_final, token_name, backup_1 },
- /* class_eol */ { move_final, token_name, backup_1 },
- /* class_rest */ { move_final, token_name, backup_1 },
- /* class_illegal */ { move_final, token_name, backup_1 },
- /* class_pound */ { move_final, token_name, backup_1 },
- /* class_dquote */ { move_final, token_name, backup_1 },
- /* class_langle */ { move_final, token_name, backup_1 },
- /* class_rangle */ { move_final, token_name, backup_1 },
- /* class_highbit */ { move_final, token_name, backup_1 },
- },
- { /* state_integer */
- /* class_blank */ { final, token_integer, backup_0 },
- /* class_punc */ { move_final, token_integer, backup_1 },
- /* class_name */ { move_final, token_integer, backup_1 },
- /* class_e */ { move_final, token_integer, backup_1 },
- /* class_escape */ { move_final, token_integer, backup_1 },
- /* class_ff */ { move_final, token_integer, backup_1 },
- /* class_digit */ { move_advance, state_integer, not_used },
- /* class_dot */ { move_advance, state_real_2, not_used },
- /* class_sign */ { move_final, token_integer, backup_1 },
- /* class_quote */ { move_final, token_integer, backup_1 },
- /* class_bslash */ { move_final, token_integer, backup_1 },
- /* class_slash */ { move_final, token_integer, backup_1 },
- /* class_star */ { move_final, token_integer, backup_1 },
- /* class_exclam */ { move_final, token_integer, backup_1 },
- /* class_eol */ { move_final, token_integer, backup_1 },
- /* class_rest */ { move_final, token_integer, backup_1 },
- /* class_illegal */ { move_final, token_integer, backup_1 },
- /* class_pound */ { move_final, token_integer, backup_1 },
- /* class_dquote */ { move_final, token_integer, backup_1 },
- /* class_langle */ { move_final, token_integer, backup_1 },
- /* class_rangle */ { move_final, token_integer, backup_1 },
- /* class_highbit */ { move_final, token_integer, backup_1 },
- },
- { /* state_real_1 */
- /* class_blank */ { move_advance, state_eat_rest, not_used },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_error, bad_prefix, backup_1 },
- /* class_e */ { move_error, bad_prefix, backup_1 },
- /* class_escape */ { move_error, bad_prefix, backup_1 },
- /* class_ff */ { special, state_real_1, control_char },
- /* class_digit */ { move_advance, state_real_2, not_used },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_error, bad_prefix, backup_1 },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_error, bad_prefix, backup_1 },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_error, bad_prefix, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_real_1, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { move_error, bad_prefix, backup_1 },
- /* class_langle */ { move_error, bad_prefix, backup_1 },
- /* class_rangle */ { move_error, bad_prefix, backup_1 },
- /* class_highbit */ { move_advance, state_eat_rest, not_used },
- },
- { /* state_real_2 */
- /* class_blank */ { final, token_real, backup_0 },
- /* class_punc */ { move_final, token_real, backup_1 },
- /* class_name */ { move_final, token_real, backup_1 },
- /* class_e */ { move_advance, state_exp_1, not_used },
- /* class_escape */ { move_final, token_real, backup_1 },
- /* class_ff */ { move_final, token_real, backup_1 },
- /* class_digit */ { move_advance, state_real_2, not_used },
- /* class_dot */ { move_final, token_real, backup_1 },
- /* class_sign */ { move_final, token_real, backup_1 },
- /* class_quote */ { move_final, token_real, backup_1 },
- /* class_bslash */ { move_final, token_real, backup_1 },
- /* class_slash */ { move_final, token_real, backup_1 },
- /* class_star */ { move_final, token_real, backup_1 },
- /* class_exclam */ { move_final, token_real, backup_1 },
- /* class_eol */ { move_final, token_real, backup_1 },
- /* class_rest */ { move_final, token_real, backup_1 },
- /* class_illegal */ { move_final, token_real, backup_1 },
- /* class_pound */ { move_final, token_real, backup_1 },
- /* class_dquote */ { move_final, token_real, backup_1 },
- /* class_langle */ { move_final, token_real, backup_1 },
- /* class_rangle */ { move_final, token_real, backup_1 },
- /* class_highbit */ { move_final, token_real, backup_1 },
- },
- { /* state_exp_1 */
- /* class_blank */ { move_final, token_real, backup_2 },
- /* class_punc */ { move_final, token_real, backup_2 },
- /* class_name */ { move_final, token_real, backup_2 },
- /* class_e */ { move_final, token_real, backup_2 },
- /* class_escape */ { move_final, token_real, backup_2 },
- /* class_ff */ { move_final, token_real, backup_2 },
- /* class_digit */ { move_advance, state_exp_3, not_used },
- /* class_dot */ { move_final, token_real, backup_2 },
- /* class_sign */ { move_advance, state_exp_2, not_used },
- /* class_quote */ { move_final, token_real, backup_2 },
- /* class_bslash */ { move_final, token_real, backup_2 },
- /* class_slash */ { move_final, token_real, backup_2 },
- /* class_star */ { move_final, token_real, backup_2 },
- /* class_exclam */ { move_final, token_real, backup_2 },
- /* class_eol */ { move_final, token_real, backup_2 },
- /* class_rest */ { move_final, token_real, backup_2 },
- /* class_illegal */ { move_final, token_real, backup_2 },
- /* class_pound */ { move_final, token_real, backup_2 },
- /* class_dquote */ { move_final, token_real, backup_2 },
- /* class_langle */ { move_final, token_real, backup_2 },
- /* class_rangle */ { move_final, token_real, backup_2 },
- /* class_highbit */ { move_final, token_real, backup_2 },
- },
- { /* state_exp_2 */
- /* class_blank */ { move_final, token_real, backup_3 },
- /* class_punc */ { move_final, token_real, backup_3 },
- /* class_name */ { move_final, token_real, backup_3 },
- /* class_e */ { move_final, token_real, backup_3 },
- /* class_escape */ { move_final, token_real, backup_3 },
- /* class_ff */ { move_final, token_real, backup_3 },
- /* class_digit */ { move_advance, state_exp_3, not_used },
- /* class_dot */ { move_final, token_real, backup_3 },
- /* class_sign */ { move_final, token_real, backup_3 },
- /* class_quote */ { move_final, token_real, backup_3 },
- /* class_bslash */ { move_final, token_real, backup_3 },
- /* class_slash */ { move_final, token_real, backup_3 },
- /* class_star */ { move_final, token_real, backup_3 },
- /* class_exclam */ { move_final, token_real, backup_3 },
- /* class_eol */ { move_final, token_real, backup_3 },
- /* class_rest */ { move_final, token_real, backup_3 },
- /* class_illegal */ { move_final, token_real, backup_3 },
- /* class_pound */ { move_final, token_real, backup_3 },
- /* class_dquote */ { move_final, token_real, backup_3 },
- /* class_langle */ { move_final, token_real, backup_3 },
- /* class_rangle */ { move_final, token_real, backup_3 },
- /* class_highbit */ { move_final, token_real, backup_3 },
- },
- { /* state_exp_3 */
- /* class_blank */ { final, token_real, backup_0 },
- /* class_punc */ { move_final, token_real, backup_1 },
- /* class_name */ { move_final, token_real, backup_1 },
- /* class_e */ { move_final, token_real, backup_1 },
- /* class_escape */ { move_final, token_real, backup_1 },
- /* class_ff */ { move_final, token_real, backup_1 },
- /* class_digit */ { move_advance, state_exp_3, not_used },
- /* class_dot */ { move_final, token_real, backup_1 },
- /* class_sign */ { move_final, token_real, backup_1 },
- /* class_quote */ { move_final, token_real, backup_1 },
- /* class_bslash */ { move_final, token_real, backup_1 },
- /* class_slash */ { move_final, token_real, backup_1 },
- /* class_star */ { move_final, token_real, backup_1 },
- /* class_exclam */ { move_final, token_real, backup_1 },
- /* class_eol */ { move_final, token_real, backup_1 },
- /* class_rest */ { move_final, token_real, backup_1 },
- /* class_illegal */ { move_final, token_real, backup_1 },
- /* class_pound */ { move_final, token_real, backup_1 },
- /* class_dquote */ { move_final, token_real, backup_1 },
- /* class_langle */ { move_final, token_real, backup_1 },
- /* class_rangle */ { move_final, token_real, backup_1 },
- /* class_highbit */ { move_final, token_real, backup_1 },
- },
- { /* state_str_1 */
- /* class_blank */ { move_advance, state_str_1, not_used },
- /* class_punc */ { move_advance, state_str_1, not_used },
- /* class_name */ { move_advance, state_str_1, not_used },
- /* class_e */ { move_advance, state_str_1, not_used },
- /* class_escape */ { move_advance, state_str_1, not_used },
- /* class_ff */ { special, state_str_1, control_char },
- /* class_digit */ { move_advance, state_str_1, not_used },
- /* class_dot */ { move_advance, state_str_1, not_used },
- /* class_sign */ { move_advance, state_str_1, not_used },
- /* class_quote */ { final, token_string, backup_0 },
- /* class_bslash */ { special, state_str_2, start_bslash },
- /* class_slash */ { move_advance, state_str_1, not_used },
- /* class_star */ { move_advance, state_str_1, not_used },
- /* class_exclam */ { move_advance, state_str_1, not_used },
- /* class_eol */ { move_final, token_ustring, backup_1 },
- /* class_rest */ { move_advance, state_str_1, not_used },
- /* class_illegal */ { special, state_str_1, control_char },
- /* class_pound */ { move_advance, state_str_1, not_used },
- /* class_dquote */ { move_advance, state_str_1, not_used },
- /* class_langle */ { move_advance, state_str_1, not_used },
- /* class_rangle */ { move_advance, state_str_1, not_used },
- /* class_highbit */ { move_advance, state_str_1, not_used },
- },
- { /* state_str_2 */
- /* class_blank */ { move_special, state_str_1, ignore_bslash },
- /* class_punc */ { move_special, state_str_1, ignore_bslash },
- /* class_name */ { move_special, state_str_1, ignore_bslash },
- /* class_e */ { move_special, state_str_1, ignore_bslash },
- /* class_escape */ { special, state_str_1, insert_char },
- /* class_ff */ { special, state_str_1, control_char },
- /* class_digit */ { special, state_str_3, found_digit },
- /* class_dot */ { move_special, state_str_1, ignore_bslash },
- /* class_sign */ { move_special, state_str_1, ignore_bslash },
- /* class_quote */ { special, state_str_1, insert_char },
- /* class_bslash */ { special, state_str_1, insert_char },
- /* class_slash */ { move_special, state_str_1, ignore_bslash },
- /* class_star */ { move_special, state_str_1, ignore_bslash },
- /* class_exclam */ { move_special, state_str_1, ignore_bslash },
- /* class_eol */ { special, state_str_1, string_wrap },
- /* class_rest */ { move_special, state_str_1, ignore_bslash },
- /* class_illegal */ { special, state_str_1, control_char },
- /* class_pound */ { move_special, state_str_1, ignore_bslash },
- /* class_dquote */ { special, state_str_1, insert_char },
- /* class_langle */ { move_special, state_str_1, ignore_bslash },
- /* class_rangle */ { move_special, state_str_1, ignore_bslash },
- /* class_highbit */ { move_special, state_str_1, ignore_bslash },
- },
- { /* state_str_3 */
- /* class_blank */ { move_special, state_str_1, missing_bslash },
- /* class_punc */ { move_special, state_str_1, missing_bslash },
- /* class_name */ { move_special, state_str_1, missing_bslash },
- /* class_e */ { move_special, state_str_1, missing_bslash },
- /* class_escape */ { move_special, state_str_1, missing_bslash },
- /* class_ff */ { special, state_str_1, control_char },
- /* class_digit */ { special, state_str_3, found_digit },
- /* class_dot */ { move_special, state_str_1, missing_bslash },
- /* class_sign */ { move_special, state_str_1, missing_bslash },
- /* class_quote */ { move_special, state_str_1, missing_bslash },
- /* class_bslash */ { special, state_str_1, end_digits },
- /* class_slash */ { move_special, state_str_1, missing_bslash },
- /* class_star */ { move_special, state_str_1, missing_bslash },
- /* class_exclam */ { move_special, state_str_1, missing_bslash },
- /* class_eol */ { move_final, token_ustring, backup_1 },
- /* class_rest */ { move_special, state_str_1, missing_bslash },
- /* class_illegal */ { special, state_str_3, control_char },
- /* class_pound */ { move_special, state_str_1, missing_bslash },
- /* class_dquote */ { move_special, state_str_1, missing_bslash },
- /* class_langle */ { move_special, state_str_1, missing_bslash },
- /* class_rangle */ { move_special, state_str_1, missing_bslash },
- /* class_highbit */ { move_special, state_str_1, missing_bslash },
- },
- { /* state_comment_1 */
- /* class_blank */ { move_final, token_punc, backup_0 },
- /* class_punc */ { move_final, token_punc, backup_1 },
- /* class_name */ { move_final, token_punc, backup_1 },
- /* class_e */ { move_final, token_punc, backup_1 },
- /* class_escape */ { move_final, token_punc, backup_1 },
- /* class_ff */ { special, state_comment_1,control_char },
- /* class_digit */ { move_final, token_punc, backup_1 },
- /* class_dot */ { move_final, token_punc, backup_1 },
- /* class_sign */ { move_final, token_punc, backup_1 },
- /* class_quote */ { move_final, token_punc, backup_1 },
- /* class_bslash */ { move_final, token_punc, backup_1 },
- /* class_slash */ { move_final, token_punc, backup_1 },
- /* class_star */ { move_advance, state_comment_2, not_used },
- /* class_exclam */ { move_final, token_punc, backup_1 },
- /* class_eol */ { move_final, token_punc, backup_1 },
- /* class_rest */ { move_final, token_punc, backup_1 },
- /* class_illegal */ { special, state_comment_1,control_char },
- /* class_pound */ { move_final, token_punc, backup_1 },
- /* class_dquote */ { move_final, token_punc, backup_1 },
- /* class_langle */ { move_final, token_punc, backup_1 },
- /* class_rangle */ { move_final, token_punc, backup_1 },
- /* class_highbit */ { move_final, token_punc, backup_1 },
- },
- { /* state_comment_2 */
- /* class_blank */ { move_advance, state_comment_2, not_used },
- /* class_punc */ { move_advance, state_comment_2, not_used },
- /* class_name */ { move_advance, state_comment_2, not_used },
- /* class_e */ { move_advance, state_comment_2, not_used },
- /* class_escape */ { move_advance, state_comment_2, not_used },
- /* class_ff */ { move_special, state_comment_2,control_char },
- /* class_digit */ { move_advance, state_comment_2, not_used },
- /* class_dot */ { move_advance, state_comment_2, not_used },
- /* class_sign */ { move_advance, state_comment_2, not_used },
- /* class_quote */ { move_advance, state_comment_2, not_used },
- /* class_bslash */ { move_advance, state_comment_2, not_used },
- /* class_slash */ { move_advance, state_comment_2, not_used },
- /* class_star */ { move_advance, state_comment_3, not_used },
- /* class_exclam */ { move_advance, state_comment_2, not_used },
- /* class_eol */ { move_special, state_comment_2,comment_wrap },
- /* class_rest */ { move_advance, state_comment_2, not_used },
- /* class_illegal */ { move_special, state_comment_2,control_char },
- /* class_pound */ { move_advance, state_comment_2, not_used },
- /* class_dquote */ { move_advance, state_comment_2, not_used },
- /* class_langle */ { move_advance, state_comment_2, not_used },
- /* class_rangle */ { move_advance, state_comment_2, not_used },
- /* class_highbit */ { move_advance, state_comment_2, not_used },
- },
- { /* state_comment_3 */
- /* class_blank */ { move_advance, state_comment_2, not_used },
- /* class_punc */ { move_advance, state_comment_2, not_used },
- /* class_name */ { move_advance, state_comment_2, not_used },
- /* class_e */ { move_advance, state_comment_2, not_used },
- /* class_escape */ { move_advance, state_comment_2, not_used },
- /* class_ff */ { move_special, state_comment_2,control_char },
- /* class_digit */ { move_advance, state_comment_2, not_used },
- /* class_dot */ { move_advance, state_comment_2, not_used },
- /* class_sign */ { move_advance, state_comment_2, not_used },
- /* class_quote */ { move_advance, state_comment_2, not_used },
- /* class_bslash */ { move_advance, state_comment_2, not_used },
- /* class_slash */ { final_comment, token_comment, not_used },
- /* class_star */ { move_advance, state_comment_3, not_used },
- /* class_exclam */ { move_advance, state_comment_2, not_used },
- /* class_eol */ { move_special, state_comment_2,comment_wrap },
- /* class_rest */ { move_advance, state_comment_2, not_used },
- /* class_illegal */ { move_special, state_comment_2,control_char },
- /* class_pound */ { move_advance, state_comment_2, not_used },
- /* class_dquote */ { move_advance, state_comment_2, not_used },
- /* class_langle */ { move_advance, state_comment_2, not_used },
- /* class_rangle */ { move_advance, state_comment_2, not_used },
- /* class_highbit */ { move_advance, state_comment_2, not_used },
- },
- { /* state_comment_4 */
- /* class_blank */ { move_advance, state_comment_4, not_used },
- /* class_punc */ { move_advance, state_comment_4, not_used },
- /* class_name */ { move_advance, state_comment_4, not_used },
- /* class_e */ { move_advance, state_comment_4, not_used },
- /* class_escape */ { move_advance, state_comment_4, not_used },
- /* class_ff */ { move_special, state_comment_4,control_char },
- /* class_digit */ { move_advance, state_comment_4, not_used },
- /* class_dot */ { move_advance, state_comment_4, not_used },
- /* class_sign */ { move_advance, state_comment_4, not_used },
- /* class_quote */ { move_advance, state_comment_4, not_used },
- /* class_bslash */ { move_advance, state_comment_4, not_used },
- /* class_slash */ { move_advance, state_comment_4, not_used },
- /* class_star */ { move_advance, state_comment_4, not_used },
- /* class_exclam */ { move_advance, state_comment_4, not_used },
- /* class_eol */ { final_comment, token_comment, backup_1 },
- /* class_rest */ { move_advance, state_comment_4, not_used },
- /* class_illegal */ { move_special, state_comment_4,control_char },
- /* class_pound */ { move_advance, state_comment_4, not_used },
- /* class_dquote */ { move_advance, state_comment_4, not_used },
- /* class_langle */ { move_advance, state_comment_4, not_used },
- /* class_rangle */ { move_advance, state_comment_4, not_used },
- /* class_highbit */ { move_advance, state_comment_4, not_used },
- },
- { /* state_eat_rest */
- /* class_blank */ { move_advance, state_eat_rest, not_used },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_error, bad_prefix, backup_1 },
- /* class_e */ { move_error, bad_prefix, backup_1 },
- /* class_escape */ { move_error, bad_prefix, backup_1 },
- /* class_ff */ { special, state_eat_rest, control_char },
- /* class_digit */ { move_error, bad_prefix, backup_1 },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_advance, state_eat_rest, not_used },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_advance, state_eat_rest, not_used },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_error, bad_prefix, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_eat_rest, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { move_error, bad_prefix, backup_1 },
- /* class_langle */ { move_error, bad_prefix, backup_1 },
- /* class_rangle */ { move_error, bad_prefix, backup_1 },
- /* class_highbit */ { move_advance, state_eat_rest, not_used },
- },
- { /* state_gstr_1 */
- /* class_blank */ { move_error, bad_prefix, backup_1 },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_advance, state_gstr_2, not_used },
- /* class_e */ { move_advance, state_gstr_2, not_used },
- /* class_escape */ { move_advance, state_gstr_2, not_used },
- /* class_ff */ { special, state_gstr_1, control_char },
- /* class_digit */ { move_error, bad_prefix, backup_1 },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_advance, state_eat_rest, not_used },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_advance, state_eat_rest, not_used },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_error, bad_prefix, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_eat_rest, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { move_error, bad_prefix, backup_1 },
- /* class_langle */ { move_error, bad_prefix, backup_1 },
- /* class_rangle */ { move_error, bad_prefix, backup_1 },
- /* class_highbit */ { move_advance, state_eat_rest, not_used },
- },
- { /* state_gstr_2 */
- /* class_blank */ { move_error, bad_prefix, backup_1 },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_advance, state_gstr_2, not_used },
- /* class_e */ { move_advance, state_gstr_2, not_used },
- /* class_escape */ { move_advance, state_gstr_2, not_used },
- /* class_ff */ { special, state_gstr_2, control_char },
- /* class_digit */ { move_advance, state_gstr_2, not_used },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_advance, state_eat_rest, not_used },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_advance, state_eat_rest, not_used },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_error, bad_prefix, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_eat_rest, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { special, state_gstr_3, charset_gstr },
- /* class_langle */ { move_error, bad_prefix, backup_1 },
- /* class_rangle */ { move_error, bad_prefix, backup_1 },
- /* class_highbit */ { move_advance, state_eat_rest, not_used },
- },
- { /* state_gstr_3 */
- /* class_blank */ { move_advance, state_gstr_3, not_used },
- /* class_punc */ { move_advance, state_gstr_3, not_used },
- /* class_name */ { move_advance, state_gstr_3, not_used },
- /* class_e */ { move_advance, state_gstr_3, not_used },
- /* class_escape */ { move_advance, state_gstr_3, not_used },
- /* class_ff */ { special, state_gstr_3, control_char },
- /* class_digit */ { move_advance, state_gstr_3, not_used },
- /* class_dot */ { move_advance, state_gstr_3, not_used },
- /* class_sign */ { move_advance, state_gstr_3, not_used },
- /* class_quote */ { move_advance, state_gstr_3, not_used },
- /* class_bslash */ { special, state_gstr_4, start_bslash },
- /* class_slash */ { move_advance, state_gstr_3, not_used },
- /* class_star */ { move_advance, state_gstr_3, not_used },
- /* class_exclam */ { move_advance, state_gstr_3, not_used },
- /* class_eol */ { move_final, token_ugstr, backup_1 },
- /* class_rest */ { move_advance, state_gstr_3, not_used },
- /* class_illegal */ { special, state_gstr_3, control_char },
- /* class_pound */ { move_advance, state_gstr_3, not_used },
- /* class_dquote */ { final, token_gstr, backup_0 },
- /* class_langle */ { move_advance, state_gstr_3, not_used },
- /* class_rangle */ { move_advance, state_gstr_3, not_used },
- /* class_highbit */ { move_special, state_gstr_3, highbit_char },
- },
- { /* state_gstr_4 */
- /* class_blank */ { move_special, state_gstr_3, ignore_bslash },
- /* class_punc */ { move_special, state_gstr_3, ignore_bslash },
- /* class_name */ { move_special, state_gstr_3, ignore_bslash },
- /* class_e */ { move_special, state_gstr_3, ignore_bslash },
- /* class_escape */ { special, state_gstr_3, insert_char },
- /* class_ff */ { special, state_gstr_3, control_char },
- /* class_digit */ { special, state_gstr_5, found_digit },
- /* class_dot */ { move_special, state_gstr_3, ignore_bslash },
- /* class_sign */ { move_special, state_gstr_3, ignore_bslash },
- /* class_quote */ { special, state_gstr_3, insert_char },
- /* class_bslash */ { special, state_gstr_3, insert_char },
- /* class_slash */ { move_special, state_gstr_3, ignore_bslash },
- /* class_star */ { move_special, state_gstr_3, ignore_bslash },
- /* class_exclam */ { move_special, state_gstr_3, ignore_bslash },
- /* class_eol */ { move_final, token_ugstr, backup_1 },
- /* class_rest */ { move_special, state_gstr_3, ignore_bslash },
- /* class_illegal */ { special, state_gstr_3, control_char },
- /* class_pound */ { move_special, state_gstr_3, ignore_bslash },
- /* class_dquote */ { special, state_gstr_3, insert_char },
- /* class_langle */ { move_special, state_gstr_3, ignore_bslash },
- /* class_rangle */ { move_special, state_gstr_3, ignore_bslash },
- /* class_highbit */ { move_special, state_gstr_3, ignore_bslash },
- },
- { /* state_gstr_5 */
- /* class_blank */ { move_special, state_gstr_3, missing_bslash },
- /* class_punc */ { move_special, state_gstr_3, missing_bslash },
- /* class_name */ { move_special, state_gstr_3, missing_bslash },
- /* class_e */ { move_special, state_gstr_3, missing_bslash },
- /* class_escape */ { move_special, state_gstr_3, missing_bslash },
- /* class_ff */ { special, state_gstr_3, control_char },
- /* class_digit */ { special, state_gstr_5, found_digit },
- /* class_dot */ { move_special, state_gstr_3, missing_bslash },
- /* class_sign */ { move_special, state_gstr_3, missing_bslash },
- /* class_quote */ { move_special, state_gstr_3, missing_bslash },
- /* class_bslash */ { special, state_gstr_3, end_digits },
- /* class_slash */ { move_special, state_gstr_3, missing_bslash },
- /* class_star */ { move_special, state_gstr_3, missing_bslash },
- /* class_exclam */ { move_special, state_gstr_3, missing_bslash },
- /* class_eol */ { move_final, token_ugstr, backup_1 },
- /* class_rest */ { move_special, state_gstr_3, missing_bslash },
- /* class_illegal */ { special, state_str_3, control_char },
- /* class_pound */ { move_special, state_gstr_3, missing_bslash },
- /* class_dquote */ { move_special, state_gstr_3, missing_bslash },
- /* class_langle */ { move_special, state_gstr_3, missing_bslash },
- /* class_rangle */ { move_special, state_gstr_3, missing_bslash },
- /* class_highbit */ { move_special, state_gstr_3, missing_bslash },
- },
- { /* state_langle */
- /* class_blank */ { move_error, bad_prefix, backup_1 },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_error, bad_prefix, backup_1 },
- /* class_e */ { move_error, bad_prefix, backup_1 },
- /* class_escape */ { move_error, bad_prefix, backup_1 },
- /* class_ff */ { special, state_langle, control_char },
- /* class_digit */ { move_error, bad_prefix, backup_1 },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_error, bad_prefix, backup_1 },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_error, bad_prefix, backup_1 },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_final, token_ugstr, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_langle, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { move_error, bad_prefix, backup_1 },
- /* class_langle */ { move_final, token_punc2, backup_0 },
- /* class_rangle */ { move_error, bad_prefix, backup_1 },
- /* class_highbit */ { move_error, bad_prefix, backup_1 },
- },
- { /* state_rangle */
- /* class_blank */ { move_error, bad_prefix, backup_1 },
- /* class_punc */ { move_error, bad_prefix, backup_1 },
- /* class_name */ { move_error, bad_prefix, backup_1 },
- /* class_e */ { move_error, bad_prefix, backup_1 },
- /* class_escape */ { move_error, bad_prefix, backup_1 },
- /* class_ff */ { special, state_langle, control_char },
- /* class_digit */ { move_error, bad_prefix, backup_1 },
- /* class_dot */ { move_error, bad_prefix, backup_1 },
- /* class_sign */ { move_error, bad_prefix, backup_1 },
- /* class_quote */ { move_error, bad_prefix, backup_1 },
- /* class_bslash */ { move_error, bad_prefix, backup_1 },
- /* class_slash */ { move_error, bad_prefix, backup_1 },
- /* class_star */ { move_error, bad_prefix, backup_1 },
- /* class_exclam */ { move_error, bad_prefix, backup_1 },
- /* class_eol */ { move_final, token_ugstr, backup_1 },
- /* class_rest */ { move_advance, state_eat_rest, not_used },
- /* class_illegal */ { special, state_langle, control_char },
- /* class_pound */ { move_error, bad_prefix, backup_1 },
- /* class_dquote */ { move_error, bad_prefix, backup_1 },
- /* class_langle */ { move_error, bad_prefix, backup_1 },
- /* class_rangle */ { move_final, token_punc2, backup_0 },
- /* class_highbit */ { move_error, bad_prefix, backup_1 },
- },
- };
- static char class_table[ 256 ] =
- {
- /* 00 */ class_eol, class_illegal, class_illegal, class_illegal,
- /* 04 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 08 */ class_illegal, class_blank, class_illegal, class_illegal,
- /* 0C */ class_ff, class_illegal, class_illegal, class_illegal,
- /* 10 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 14 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 18 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 1C */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 20 */ class_blank, class_exclam, class_dquote, class_pound,
- /* 24 */ class_name, class_rest, class_punc, class_quote,
- /* 28 */ class_punc, class_punc, class_star, class_sign,
- /* 2C */ class_punc, class_sign, class_dot, class_slash,
- /* 30 */ class_digit, class_digit, class_digit, class_digit,
- /* 34 */ class_digit, class_digit, class_digit, class_digit,
- /* 38 */ class_digit, class_digit, class_punc, class_punc,
- /* 3C */ class_langle, class_punc, class_rangle, class_rest,
- /* 40 */ class_rest, class_name, class_name, class_name,
- /* 44 */ class_name, class_e, class_name, class_name,
- /* 48 */ class_name, class_name, class_name, class_name,
- /* 4C */ class_name, class_name, class_name, class_name,
- /* 50 */ class_name, class_name, class_name, class_name,
- /* 54 */ class_name, class_name, class_name, class_name,
- /* 58 */ class_name, class_name, class_name, class_rest,
- /* 5C */ class_bslash, class_rest, class_punc, class_name,
- /* 60 */ class_rest, class_name, class_escape, class_name,
- /* 64 */ class_name, class_e, class_escape, class_name,
- /* 68 */ class_name, class_name, class_name, class_name,
- /* 6C */ class_name, class_name, class_escape, class_name,
- /* 70 */ class_name, class_name, class_escape, class_name,
- /* 74 */ class_escape, class_name, class_escape, class_name,
- /* 78 */ class_name, class_name, class_name, class_punc,
- /* 7C */ class_punc, class_punc, class_punc, class_illegal,
- /* 80 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 84 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 88 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 8C */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 90 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 94 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 98 */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* 9C */ class_illegal, class_illegal, class_illegal, class_illegal,
- /* A0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* A4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* A8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* AC */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* B0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* B4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* B8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* BC */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* C0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* C4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* C8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* CC */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* D0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* D4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* D8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* DC */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* E0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* E4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* E8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* EC */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* F0 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* F4 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* F8 */ class_highbit, class_highbit, class_highbit, class_highbit,
- /* FC */ class_highbit, class_highbit, class_highbit, class_highbit
- };
- /* Tables to correlate token numbers and ASCII values for
- punctuation characters. Used by yylex and lex_issue_error. */
- #define tok_punc_token_num 17
- static unsigned char punc_char[tok_punc_token_num] = {
- '{', '}', '=', ';', '(', ')', ':', '+', '-',
- ',', '&', '~', '*', '/', '^', '|', '#'};
- static int punc_token[tok_punc_token_num] =
- { LEFT_BRACE,
- RIGHT_BRACE,
- EQUAL_SIGN,
- SEMICOLON,
- LEFT_PAREN,
- RIGHT_PAREN,
- COLON,
- PLUS,
- MINUS,
- COMMA,
- AND,
- NOT,
- MULTIPLY,
- DIVIDE,
- XOR,
- OR,
- POUND };
- /* Tables to correlate token numbers and ASCII value pairs for
- punctuation characters. Used by yylex and lex_issue_error. */
- static unsigned char punc2_char[2] = {'<', '>'};
- static int punc2_token[2] =
- { LEFT_SHIFT,
- RIGHT_SHIFT };
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function returns the next token to be built in the UIL source
- ** program being read by the compiler.
- **
- ** FORMAL PARAMETERS:
- **
- ** none
- **
- ** IMPLICIT INPUTS:
- **
- **
- **
- ** IMPLICIT OUTPUTS:
- **
- **
- **
- ** FUNCTION VALUE:
- **
- ** number of the token generated
- **
- ** SIDE EFFECTS:
- **
- **
- **
- **
- **--
- **/
- int yylex()
- {
- unsigned char c_char; /* current character */
- int l_class; /* current character's class */
- int l_state; /* current token_table state */
- int l_lex_pos; /* next available position in c_lex_buffer*/
- cell z_cell; /* local copy of current token_table state*/
- int l_bslash_value; /* current value of \digit...\ construct */
- int l_start_src_pos; /* starting source position of a token */
- int l_charset; /* character set for strings */
- int l_write_direction; /* writing direction */
- int l_parse_direction; /* parsing direction */
- int l_charset_sixteen_bit = FALSE; /* true if charset is 16-bit */
- sym_value_entry_type
- *az_charset_entry; /* value entry for the current charset */
- int l_16bit_char_count = 0; /* for strings, count 16-bit chars */
- int l_16bit_chars_only; /* True if the gstr we are */
- /* processing only has 16-bit chars */
- src_source_record_type
- *az_start_src_record;/* starting source record of a token */
- lex_buffer_type
- *az_current_lex_buffer; /* current lexical buffer */
- az_charset_entry = (sym_value_entry_type *) 0;
- /*
- ** Call the Status callback routine to report our progress.
- */
- /* %COMPLETE (between 0-50) */
- Uil_percent_complete =
- CEIL((int)( .5 * ((float)Uil_characters_read/(float)Uil_file_size))*100, 50);
- if (Uil_cmd_z_command.status_cb != (Uil_continue_type(*)())NULL)
- diag_report_status();
- initialize_token_builder:
- /* initialize the lexical analyzer by
- * saving starting source position of the token
- * resetting the lexical buffer
- * putting the analyser in its initial state */
- az_start_src_record = src_az_current_source_record;
- l_start_src_pos = src_az_current_source_buffer->w_current_position;
- az_current_lex_buffer = az_first_lex_buffer;
- l_lex_pos = 0;
- l_charset = lex_k_default_charset;
- l_16bit_chars_only = FALSE;
- l_state = state_initial;
-
- /* start looking for the token */
- continue_in_next_state:
- for (;;)
- {
- /* get next input char */
- /* advance source too */
- c_char = src_az_current_source_buffer->c_text
- [ src_az_current_source_buffer->w_current_position++ ];
- /* %COMPLETE */
- Uil_characters_read++;
- l_class = class_table[ c_char ]; /* determine its class */
- z_cell = token_table[ l_state][l_class ]; /* load state cell */
- /* pick up the next state, or terminal, or error */
- l_state = z_cell.next_state;
- /* l_state is negative for action states requiring the current
- * character be saved in the current lexical buffer */
- if (z_cell.action & NEGATIVE)
- {
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[ l_lex_pos ] = c_char;
- l_lex_pos++;
- }
- /* next step is based on action */
- switch (z_cell.action)
- {
- case move_advance:
- case advance:
- if (l_16bit_chars_only) goto found_16bit_char;
- continue;
- case reset:
-
- goto initialize_token_builder;
- case move_final:
- case final:
- case final_comment: /* RAP retain comments */
- goto found_token;
- case move_error:
- case error:
- goto found_error;
- case move_special:
- case special:
- goto special_processing;
- default:
- _assert( FALSE, "unknown token_table action" );
- }
- }
- /* process special actions */
- special_processing:
- switch (z_cell.backup) /* backup holds special processing code */
- {
- case control_char: /* encountered a control char in a string or
- * comment - issue a diagnotic and continue */
- issue_control_char_diagnostic( c_char );
- break;
- case start_bslash: /* start of a \ construct in a string */
- l_bslash_value = 0; /* initialize collection cell */
- break;
- case found_digit: /* next digit in a \digit...\ sequence */
- if (l_bslash_value < 256 ) /* if still in range add in next digit */
- l_bslash_value = l_bslash_value * 10 + ( c_char - 48 );
- break;
- case end_digits: /* end of \digit...\ sequence */
- if (l_bslash_value >= 256 ) /* issue a diagnostic */
- { diag_issue_diagnostic
- ( d_out_range,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "\\digit...\\ sequence",
- "0-255" );
- l_bslash_value = lex_k_unprint_sub;
- }
- if (l_bslash_value == 0 ) /* issue a diagnostic */
- { diag_issue_diagnostic
- ( d_null,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1 );
- }
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[ l_lex_pos++ ] = l_bslash_value;
- break;
- case insert_char: /* place special character in lex buffer */
- {
-
- static unsigned char c_bslash_char[10] = {
- '\\', '\'', 'n', 't', 'v', 'b', 'r', 'f', '"'};
- static unsigned char ab_bslash_value[9] =
- { 0x5C, 0x27, 0x0A, 0x09, 0x0B, 0x08, 0x0D, 0x0C, 0x22 };
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[ l_lex_pos++ ] =
- ab_bslash_value
- [ _index( c_char, c_bslash_char, sizeof( c_bslash_char )-1 )];
- break;
- }
- case missing_bslash: /* \digit...\ sequence not terminated */
- diag_issue_diagnostic
- ( d_unterm_seq,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "\\digit...\\ sequence",
- "with \\" );
- break;
- case ignore_bslash: /* \ not followed by valid character */
- diag_issue_diagnostic
- ( d_backslash_ignored,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- c_char );
- break;
- case string_wrap:
- if (src_get_source_line( ) == src_k_end_source)
- {
- diag_issue_diagnostic
- ( d_unterm_seq,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "character string",
- "before end of source" );
- src_az_current_source_buffer->w_current_position--;
- }
- break;
- case comment_wrap:
- if (src_get_source_line( ) == src_k_end_source)
- {
- diag_issue_diagnostic
- ( d_unterm_seq,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "comment",
- "before end of source" );
- src_az_current_source_buffer->w_current_position--;
- return UILEOF;
- }
- az_current_lex_buffer->
- c_text[strlen((char *)az_current_lex_buffer->c_text)] = '\n';
- break;
- case highbit_char: /* check if must accept extra chars */
- found_16bit_char:
- {
- unsigned char next_char;
-
- /*
- ** If the current character set allows 16-bit characters, then
- ** process them specially.
- */
- if ( l_charset_sixteen_bit )
- {
- /* need to:
- ** 1) get next input char and advance the source
- ** 2) check that the next is not a control character
- ** 3) place the next character in the lex buffer
- */
- next_char = src_az_current_source_buffer->c_text
- [ src_az_current_source_buffer->w_current_position++ ];
- switch (class_table[ next_char ])
- {
- case class_eol:
- src_az_current_source_buffer->w_current_position--;
- case class_illegal:
- issue_control_char_diagnostic( next_char );
- break;
- default:
- break;
- }
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[ l_lex_pos++ ] = next_char;
- l_16bit_char_count ++;
- }
- break;
- }
- case charset_gstr: /* set l_charset with the char set */
- {
- _assert( FALSE, "Should never get to charset_gstr" );
- break;
- }
- case nocharset_gstr:
- if (Uil_lex_l_charset_specified) {
- /* use the specified charset*/
- l_charset = Uil_lex_l_literal_charset;
- az_charset_entry = Uil_lex_az_literal_charset;
- }
- else if (Uil_lex_l_localized) goto found_localized_string;
- else {
- /* No charset specified, use the default */
- l_charset = Uil_lex_l_user_default_charset;
- az_charset_entry = Uil_lex_az_charset_entry;
- }
- /* Get the charset information */
- sem_charset_info
- (l_charset,
- az_charset_entry,
- &l_write_direction,
- &l_parse_direction,
- &l_charset_sixteen_bit);
- /* reset 16 bit character count to 0 */
- l_16bit_char_count = 0;
- /*
- ** if this is a user-defined, 16-bit charset then treat all
- ** as 16-bit.
- */
- if ((l_charset_sixteen_bit) && (l_charset == lex_k_userdefined_charset))
- l_16bit_chars_only = TRUE;
- break;
- default:
- _assert( FALSE, "unknown token_table special action" );
- }
- /* Next state of the token builder is should already be in l_state.
- * Continue at this point */
- goto continue_in_next_state;
- found_localized_string:
- {
- /* Local variables */
- int mb_len, i;
- unsigned char mb_byte;
-
- /* Should be looking at the first byte of the string. */
- /* Localize... */
- _MrmOSSetLocale("");
-
- /* Parse the string. */
- while (TRUE)
- {
- mb_len = mblen((char *)&src_az_current_source_buffer->c_text
- [src_az_current_source_buffer->w_current_position],
- MB_CUR_MAX);
-
- mb_byte = src_az_current_source_buffer->c_text
- [src_az_current_source_buffer->w_current_position];
- if (mb_len == 1)
- switch (class_table[mb_byte])
- {
- case class_eol:
- z_cell.backup = backup_0;
- l_state = token_ugstr;
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer =
- get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[ l_lex_pos++ ] = mb_byte;
- _MrmOSSetLocale("C");
- goto found_token;
- case class_dquote:
- z_cell.backup = backup_0;
- l_state = token_lstr;
- src_az_current_source_buffer->w_current_position++;
- _MrmOSSetLocale("C");
- goto found_token;
- default:
- break;
- }
-
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer( az_current_lex_buffer );
- l_lex_pos = 0;
- }
- for (i = 0; i < mb_len; i++)
- {
- if (l_lex_pos > l_max_lex_buffer_pos )
- {
- az_current_lex_buffer = get_lex_buffer(az_current_lex_buffer);
- l_lex_pos = 0;
- }
- az_current_lex_buffer->c_text[l_lex_pos++] =
- src_az_current_source_buffer->c_text
- [src_az_current_source_buffer->w_current_position++];
- }
- }
- }
-
- found_token:
- /* do any backup of the source buffer position and lex buffer */
- src_az_current_source_buffer->w_current_position -= z_cell.backup;
- l_lex_pos -= z_cell.backup;
- /* put a null at the end of the current lex buffer */
- az_current_lex_buffer->c_text[ l_lex_pos ] = 0;
- /* case on the token found */
- switch (l_state) /* l_state holds the token found */
- {
- case token_name:
- {
- key_keytable_entry_type *az_keyword;
- /* check the case sensitivity flag and change case if necessary */
- if (! uil_v_case_sensitive)
- {
- char * ptr;
- for ( ptr = (char *)(az_current_lex_buffer->c_text);
- (* ptr) != 0;
- (* ptr) = _upper (* ptr), ptr++)
- {}
- }
- /* check if the name is a keyword */
- az_keyword =
- key_find_keyword( l_lex_pos, (char *)az_current_lex_buffer->c_text );
- if( az_keyword != NULL)
- {
- /* check that the length of the name is in range */
- if (l_lex_pos > key_k_keyword_max_length)
- {
- l_lex_pos = key_k_keyword_max_length;
- az_current_lex_buffer->c_text[ l_lex_pos ] = 0;
- diag_issue_diagnostic
- ( d_name_too_long,
- az_start_src_record,
- l_start_src_pos,
- az_current_lex_buffer->c_text );
- }
- yylval.value.az_keyword_entry = az_keyword;
- yylval.b_type = az_keyword->b_token;
- break;
- }
- /* process the name as an identifier */
- /* check that the length of the identifier is in range */
- /* Added for fix to CR 5566 */
- if (l_lex_pos > lex_k_identifier_max_length)
- {
- l_lex_pos = lex_k_identifier_max_length;
- az_current_lex_buffer->c_text[ l_lex_pos ] = 0;
- diag_issue_diagnostic
- ( d_name_too_long,
- az_start_src_record,
- l_start_src_pos,
- lex_k_identifier_max_length,
- az_current_lex_buffer->c_text );
- }
- yylval.value.az_symbol_entry =
- (sym_entry_type *) sym_insert_name( l_lex_pos, (char *)az_current_lex_buffer->c_text );
- yylval.b_type = NAME;
- break;
- }
- case token_punc:
- {
- int l_token;
- /* found a punctuation mark - look up its token number in a table */
- l_token = punc_token
- [ _index( az_current_lex_buffer->c_text[ 0 ],
- punc_char, sizeof( punc_char )) ];
- yylval.b_type = l_token;
- break;
- }
- case token_punc2:
- {
- int l_token;
- /* found a punctuation mark - look up its token number in a table */
- l_token = punc2_token
- [ _index( az_current_lex_buffer->c_text[ 0 ],
- punc2_char, sizeof( punc2_char )) ];
- yylval.b_type = l_token;
- break;
- }
- case token_eol:
-
- /* if there is no more source
- * then return an end of file
- * otherwise go look for the next token */
- if (src_get_source_line( ) == src_k_end_source)
- return UILEOF;
- goto initialize_token_builder;
- case token_integer:
- {
- long l_integer;
- yylval.b_type = UNS_INT_LITERAL;
- /* convert the text to binary
- * the sign of the number is applied as part of semantic
- * analysis; thus we only handle integers in range 0..2**31-1
- */
- errno = 0;
- l_integer = cvt_ascii_to_long(az_current_lex_buffer->c_text);
- if (errno != 0)
- diag_issue_diagnostic
- ( d_out_range,
- az_start_src_record,
- l_start_src_pos,
- "integer",
- " " );
- yylval.value.az_symbol_entry =
- (sym_entry_type *)sem_create_value_entry
- ( (char *)&l_integer, sizeof( long ), sym_k_integer_value );
- break;
- }
- case token_ustring:
- diag_issue_diagnostic
- ( d_unterm_seq,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "character string",
- "before end of line" );
- case token_comment: /* RAP preserve comments */
- {
- int size;
- if (last_token_seen != token_comment)
- comment_text[0]=0;
- size = (int)strlen((char *)az_current_lex_buffer->c_text)+1;
- if ((size + (int)strlen (comment_text)) >= comment_size)
- {
- comment_text = XtRealloc(comment_text, INCR_COMMENT_SIZE + strlen(comment_text));
- comment_size = INCR_COMMENT_SIZE + strlen (comment_text);
- }
-
- strcat (comment_text, (char *)az_current_lex_buffer->c_text);
- strcat (comment_text, "\n");
- last_token_seen = token_comment;
- goto initialize_token_builder;
- }
- case token_string:
- found_primitive_string:
- {
- int l_length;
- lex_buffer_type *az_lex_buffer;
- sym_value_entry_type *az_value;
- unsigned char *c_char;
- l_length = l_lex_pos;
- for (az_lex_buffer = az_first_lex_buffer;
- az_lex_buffer != az_current_lex_buffer;
- az_lex_buffer = az_lex_buffer->az_next_buffer)
- l_length = l_length + l_max_lex_buffer_pos + 1;
- az_value = create_str_entry( l_length, l_charset, az_charset_entry );
- c_char = (unsigned char *)az_value->value.c_value;
- for (az_lex_buffer = az_first_lex_buffer;
- az_lex_buffer != az_current_lex_buffer;
- az_lex_buffer = az_lex_buffer->az_next_buffer)
- {
- _move( c_char, az_lex_buffer->c_text, l_max_lex_buffer_pos + 1);
- c_char = c_char + l_max_lex_buffer_pos + 1;
- }
- _move( c_char, az_lex_buffer->c_text, l_lex_pos );
- yylval.value.az_symbol_entry = (sym_entry_type *) az_value;
- yylval.b_type = CHAR_8_LITERAL;
- break;
- }
- case token_real:
- {
- double d_real;
- yylval.b_type = UNS_FLOAT_LITERAL;
- errno = 0;
- d_real = atof((char *)az_current_lex_buffer->c_text);
- if (errno != 0)
- diag_issue_diagnostic
- ( d_out_range,
- az_start_src_record,
- l_start_src_pos,
- "real",
- " " );
- yylval.value.az_symbol_entry =
- (sym_entry_type *)sem_create_value_entry
- ( (char *)&d_real, sizeof( double ), sym_k_float_value );
- break;
- }
-
- case token_ff:
- if (l_start_src_pos != 0)
- issue_control_char_diagnostic( c_char );
- src_az_current_source_record->b_flags |= src_m_form_feed;
- goto initialize_token_builder;
- case token_ugstr:
- diag_issue_diagnostic
- ( d_unterm_seq,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- "character string",
- "before end of line" );
- case token_gstr:
- /*
- ** Some general strings require special processing. Those
- ** that do not can go thru the normal string code.
- */
- if ( l_parse_direction == XmSTRING_DIRECTION_R_TO_L )
- {
- int i,j;
- unsigned char tmp1;
- unsigned char tmp2;
- /* assuming the string is confined to a single lex buffer. */
- /* just flip the characters around. 16-bit characters need to */
- /* be done in groups of two bytes */
- if (l_charset_sixteen_bit != TRUE)
- /*
- ** Just reverse the bytes from the first to last
- */
- for (i=0, j=l_lex_pos-1; i < (l_lex_pos>>1); i++,j--)
- {
- tmp1 = az_current_lex_buffer->c_text[ i ];
- az_current_lex_buffer->c_text[ i ] =
- az_current_lex_buffer->c_text[ j ];
- az_current_lex_buffer->c_text[ j ] = tmp1;
- }
- /*
- ** Don't reverse the string if have less than 2 characters (4 bytes)
- */
- else if ((l_lex_pos>>1) > 1)
- /*
- ** This reversing doesn't work for mixed 8/16-bit character
- ** sets, but only built-in character sets allow mixing and
- ** they are not right-to-left. We do the same copying as in
- ** the 8-bit case above, but we move two bytes at a time and
- ** reverse the order as we copy so they end up correct.
- */
- for (i=0, j=l_lex_pos-1; i < (l_lex_pos>>1); i+=2,j-=2)
- {
- tmp1 = az_current_lex_buffer->c_text[ i ];
- tmp2 = az_current_lex_buffer->c_text[ i + 1 ];
- az_current_lex_buffer->c_text[ i ] =
- az_current_lex_buffer->c_text[ j - 1 ];
- az_current_lex_buffer->c_text[ i + 1 ] =
- az_current_lex_buffer->c_text[ j ];
- az_current_lex_buffer->c_text[ j ] = tmp2;
- az_current_lex_buffer->c_text[ j - 1 ] = tmp1;
- }
- }
- /*
- ** If the string isn't 16-bit or it is userdefined and thus
- ** cannot be mixed 8/16-bit then we can just make a primitive
- ** string.
- */
- if ((l_charset_sixteen_bit != TRUE) ||
- (l_charset == lex_k_userdefined_charset))
- goto found_primitive_string;
- else
- {
-
- sym_value_entry_type *cstr_entry;
- sym_value_entry_type *str_entry;
- int a_off, off;
- /*
- ** if string consists solely of 8-bit ascii characters,
- ** l_16bit_char_count will be zero.
- ** if string consists solely of 16 bit characters,
- ** l_16bit_char_count*2 will equal l_lex_pos.
- ** In either of these cases, the result is still a
- ** primitive string.
- */
- /*
- ** For KANJI and HANZI treat 8-bit characters as ISO_LATIN1.
- */
- if (l_16bit_char_count == 0)
- {
- l_charset = uil_sym_isolatin1_charset;
- goto found_primitive_string;
- }
- /*
- ** If the string only contains 16-bit characters,
- ** it still can be stored as a primitive string.
- */
- if ((l_16bit_char_count<<1) == l_lex_pos)
- goto found_primitive_string;
- /*
- ** lex buffer is a mix of 8 and 16 bit characters.
- ** need to build a compound string.
- */
- cstr_entry = sem_create_cstr();
- for ( a_off = 0,
- off = 0;
- off < l_lex_pos;
- )
- {
- for (off = a_off; off < l_lex_pos; off++)
- if (az_current_lex_buffer->c_text[ off ] > 0x97)
- break;
- /*
- * Create the 8 bit string with iso_latin1
- */
- if (off > a_off)
- {
- str_entry = create_str_entry
- ( off - a_off,
- uil_sym_isolatin1_charset,
- az_charset_entry );
- _move( str_entry->value.c_value,
- &az_current_lex_buffer->c_text[ a_off ],
- off-a_off );
- sem_append_str_to_cstr( cstr_entry, str_entry, TRUE );
- }
- for (a_off = off; a_off < l_lex_pos; a_off += 2)
- if (az_current_lex_buffer->c_text[ a_off ] <= 0x97)
- break;
- /*
- * Create the 16 bit string with its charset
- */
- if (a_off > off)
- {
- str_entry =
- create_str_entry( a_off - off, l_charset, az_charset_entry );
- _move( str_entry->value.c_value,
- &az_current_lex_buffer->c_text[ off ],
- a_off-off );
- sem_append_str_to_cstr( cstr_entry, str_entry, TRUE );
- }
- }
- yylval.value.az_symbol_entry = (sym_entry_type *)cstr_entry;
- yylval.b_type = COMP_STRING;
- }
- break;
- case token_lstr:
- {
- int l_length = 0;
- lex_buffer_type *az_lex_buffer;
- sym_value_entry_type *str_entry;
- unsigned char *c_char;
- l_length = l_lex_pos;
- for (az_lex_buffer = az_first_lex_buffer;
- az_lex_buffer != az_current_lex_buffer;
- az_lex_buffer = az_lex_buffer->az_next_buffer)
- l_length = l_length + l_max_lex_buffer_pos + 1;
- str_entry = create_str_entry(l_length, lex_k_fontlist_default_tag,
- az_charset_entry );
- c_char = (unsigned char *)str_entry->value.c_value;
- for (az_lex_buffer = az_first_lex_buffer;
- az_lex_buffer != az_current_lex_buffer;
- az_lex_buffer = az_lex_buffer->az_next_buffer)
- {
- _move( c_char, az_lex_buffer->c_text, l_max_lex_buffer_pos + 1);
- c_char = c_char + l_max_lex_buffer_pos + 1;
- }
- _move( c_char, az_lex_buffer->c_text, l_lex_pos );
-
- yylval.value.az_symbol_entry = (sym_entry_type *)str_entry;
- yylval.b_type = LOC_STRING;
- break;
- }
- default:
- _assert( FALSE, "unknown token table final state" );
- }
- /* RAP we want to keep track of whether we are appending sequential comments */
- last_token_seen = l_state;
- /* set position information in token value */
- yylval.az_source_record = az_start_src_record;
- yylval.b_source_pos = l_start_src_pos;
- yylval.b_source_end = src_az_current_source_buffer->w_current_position; /* was "l_start_src_pos + l_lex_pos;" */
- yylval.b_tag = sar_k_token_frame;
- /* dump the token if requested */
- #if debug_version
- if (uil_v_dump_tokens)
- dump_token( az_current_lex_buffer, l_lex_pos );
- #endif
- /*
- ** save this token
- */
- prev_yylval = yylval;
- /* return the token generated */
- return yylval.b_type;
- found_error:
- /* do any backup of the source buffer position and lex buffer */
- src_az_current_source_buffer->w_current_position -= z_cell.backup;
- l_lex_pos -= z_cell.backup;
- /* put a null at the end of the current lex buffer */
- az_current_lex_buffer->c_text[ l_lex_pos ] = 0;
- /* case on the type of error */
- switch (l_state) /* contains the type of error */
- {
- case bad_prefix:
- /* printable characters that are not part of a token were found */
- diag_issue_diagnostic
- ( d_unknown_seq,
- az_start_src_record,
- l_start_src_pos,
- az_current_lex_buffer->c_text );
- break;
- default:
- _assert( FALSE, "unknown token table error state" );
- break;
- }
- goto initialize_token_builder;
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function initializes the lexical analyzer.
- **
- ** FORMAL PARAMETERS:
- **
- ** none
- **
- ** IMPLICIT INPUTS:
- **
- ** none
- **
- ** IMPLICIT OUTPUTS:
- **
- ** az_first_lex_buffer
- **
- ** FUNCTION VALUE:
- **
- ** void
- **
- ** SIDE EFFECTS:
- **
- ** lexical buffer is allocated
- **
- **--
- **/
- #define UNSCHAR_MINUS_ONE (unsigned char) 255;
- void lex_initialize_analyzer( )
- {
- String language;
- /* RAP preserve comments */
- comment_text = (char *) _get_memory(INITIAL_COMMENT_SIZE);
- comment_size = INITIAL_COMMENT_SIZE;
- comment_text[0] = '\0';
- /* BEGIN OSF Fix CR 4749 */
- /* The lex algorithm has the potential to write
- * into index l_max_lex_buffer_pos + 1, so allocate l_max_lex_buffer_pos
- * plus 2 positions in buffer.
- */
- az_first_lex_buffer =
- (lex_buffer_type *) _get_memory (l_max_lex_buffer_pos + 2 +
- sizeof(lex_buffer_type *));
- /* END OSF Fix CR 4749 */
- az_first_lex_buffer->az_next_buffer = NULL;
- /* Initialize the stack frame entry for epsilon productions. */
- gz_yynullval.b_tag = sar_k_null_frame;
- /* Initialize the default character set */
- language = (char *) _XmStringGetCurrentCharset();
- if ( language == NULL )
- Uil_lex_l_user_default_charset = lex_k_default_charset;
- else
- {
- Uil_lex_l_user_default_charset = sem_charset_lang_name (language);
- if (Uil_lex_l_user_default_charset == sym_k_error_charset)
- {
- diag_issue_diagnostic
- ( d_bad_lang_value,
- diag_k_no_source,
- diag_k_no_column);
- Uil_lex_l_user_default_charset = lex_k_default_charset;
- }
- }
- Uil_lex_az_charset_entry = NULL;
- /* Determine if localized strings are possible */
- if (Uil_cmd_z_command.v_use_setlocale == FALSE)
- Uil_lex_l_localized = FALSE;
- else
- {
- Uil_lex_l_localized = TRUE;
- _MrmOSSetLocale("C");
- }
- /* Initialize the current character set */
- Uil_lex_l_charset_specified = FALSE;
- /* Initialize the source position and record */
- prev_yylval.b_source_end = UNSCHAR_MINUS_ONE;
- prev_yylval.az_source_record = src_az_current_source_record;
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function performs the cleanup processing of the lexical analyzer.
- **
- ** FORMAL PARAMETERS:
- **
- ** none
- **
- ** IMPLICIT INPUTS:
- **
- ** az_first_lex_buffer
- **
- ** IMPLICIT OUTPUTS:
- **
- ** az_first_lex_buffer
- **
- ** FUNCTION VALUE:
- **
- ** void
- **
- ** SIDE EFFECTS:
- **
- ** lexical buffer is freed
- **
- **--
- **/
- void Uil_lex_cleanup_analyzer( )
- {
- /* pointer to next buffer to free */
- lex_buffer_type *az_buffer_to_free;
- /* Loop through the list of buffers freeing them all */
- while (az_first_lex_buffer != NULL) {
- az_buffer_to_free = az_first_lex_buffer;
- az_first_lex_buffer = az_first_lex_buffer->az_next_buffer;
- _free_memory((char*)az_buffer_to_free);
- }
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function issues a syntax error. It is called from the
- ** error handling mechanism in the parser.
- **
- ** FORMAL PARAMETERS:
- **
- ** restart_token the token number for the punctuation
- ** character where parsing will resume after
- ** this error is issued.
- **
- ** IMPLICIT INPUTS:
- **
- ** current lex buffer
- ** punc_token and punc_char tables
- **
- ** IMPLICIT OUTPUTS:
- **
- ** none
- **
- ** FUNCTION VALUE:
- **
- ** void
- **
- ** SIDE EFFECTS:
- **
- ** issue a diagnostic
- **
- **--
- **/
- void lex_issue_error( restart_token )
- int restart_token;
- {
- int i, token_num;
- unsigned char c_char = '.';
- char * tok_name;
- /* Find the token number for the restart character in the table.
- It should be there. Get the corresponding character for this
- token. */
- for ( i = 0 ; i<tok_punc_token_num ; i++ )
- {
- if (restart_token == punc_token [i])
- {
- c_char = punc_char [i];
- break;
- }
- }
- /* Get the text of the token name which caused the error. */
- token_num = yylval.b_type;
- if ( (token_num < 0) || (token_num > tok_num_tokens) )
- tok_name = "UNKNOWN_TOKEN";
- else
- tok_name = tok_token_name_table[token_num];
- /* Issue the error. */
- diag_issue_diagnostic
- (d_syntax,
- yylval.az_source_record,
- yylval.b_source_pos,
- tok_name,
- c_char);
- }
- /*
- **
- ** LOCAL FUNCTIONS
- **
- */
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** Issue an error for an illegal control character.
- **
- ** FORMAL PARAMETERS:
- **
- ** c_char
- **
- ** IMPLICIT INPUTS:
- **
- ** current source position
- **
- ** IMPLICIT OUTPUTS:
- **
- ** none
- **
- ** FUNCTION VALUE:
- **
- ** void
- **
- ** SIDE EFFECTS:
- **
- ** issue a diagnostic
- **
- **--
- **/
- void issue_control_char_diagnostic
- (unsigned char c_char )
- {
- diag_issue_diagnostic
- ( d_control_char,
- src_az_current_source_record,
- src_az_current_source_buffer->w_current_position - 1,
- c_char );
- src_az_current_source_record->b_flags |= src_m_unprintable_chars;
- return;
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function obtains another lexical buffer.
- **
- ** FORMAL PARAMETERS:
- **
- ** az_current_lex_buffer
- **
- ** IMPLICIT INPUTS:
- **
- ** none
- **
- ** IMPLICIT OUTPUTS:
- **
- ** none
- **
- ** FUNCTION VALUE:
- **
- ** address of a new lexical buffer
- **
- ** SIDE EFFECTS:
- **
- ** another lexical buffer may be allocated
- **
- **--
- **/
- static lex_buffer_type *get_lex_buffer( az_current_lex_buffer )
- lex_buffer_type *az_current_lex_buffer;
- {
- lex_buffer_type *az_lex_buffer;
- /* check to see if another buffer is available - if not allocate one */
- az_lex_buffer = az_current_lex_buffer->az_next_buffer;
- if (az_lex_buffer == NULL)
- {
- /* BEGIN OSF Fix CR 4749 */
- /* The lex algorithm has the potential to write
- * into index l_max_lex_buffer_pos + 1, so allocate l_max_lex_buffer_pos
- * plus 2 positions in buffer.
- */
- az_lex_buffer =
- (lex_buffer_type *)_get_memory( l_max_lex_buffer_pos + 2 +
- sizeof(lex_buffer_type *));
- /* END OSF Fix CR 4749 */
- az_current_lex_buffer->az_next_buffer = az_lex_buffer;
- az_lex_buffer->az_next_buffer = NULL;
- }
- return az_lex_buffer;
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This procedure will change all the unprintable characters in
- ** a buffer to lex_k_unprint_sub.
- **
- ** FORMAL PARAMETERS:
- **
- ** buffer buffer to be checked
- ** length length of the buffer
- ** flags lex_m_filter_xxx flags to indicate if additional
- ** characters should be filtered.
- **
- ** IMPLICIT INPUTS:
- **
- ** class_table gives the unprintable characters
- **
- ** IMPLICIT OUTPUTS:
- **
- ** none
- **
- ** FUNCTION VALUE:
- **
- ** void
- **
- ** SIDE EFFECTS:
- **
- ** none
- **
- **--
- **/
- void lex_filter_unprintable_chars
- (unsigned char *buffer,
- int length,
- unsigned long flags )
- {
- int i;
-
- for (i=0; i<length; i++)
- {
- if ((class_table[ buffer[ i ] ] == class_illegal) ||
- (buffer[ i ] == 12) || /* form feed */
- (buffer[ i ] == 0) || /* null */
- ( (flags & lex_m_filter_tab)
- && buffer[ i ] == 9 )/* horizontal tab */
- )
- buffer[ i ] = lex_k_unprint_sub;
- }
- }
- #if debug_version
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This procedure will dump a token.
- **
- ** FORMAL PARAMETERS:
- **
- **
- ** IMPLICIT INPUTS:
- **
- **
- ** IMPLICIT OUTPUTS:
- **
- **
- ** SIDE EFFECTS:
- **
- **
- **--
- **/
- static void dump_token( az_current_lex_buffer,
- l_lex_pos)
- lex_buffer_type *az_current_lex_buffer;
- int l_lex_pos;
- {
- unsigned char c_buffer[l_max_lex_buffer_pos +2];
- lex_buffer_type *az_lex_buffer;
- int i;
- int last;
- int last_buffer;
- unsigned char c_char;
- _debug_output
- ("token: %d start: %d, %d end: %d, %d \n",
- yylval.b_type,
- yylval.az_source_record->w_line_number,
- yylval.b_source_pos,
- src_az_current_source_record->w_line_number,
- src_az_current_source_buffer->w_current_position );
- for (az_lex_buffer = az_first_lex_buffer;
- ;
- az_lex_buffer = az_lex_buffer->az_next_buffer)
- {
- last_buffer = ( az_lex_buffer == az_current_lex_buffer );
- if (last_buffer)
- last = l_lex_pos;
- else
- last = l_max_lex_buffer_pos+1;
- _move( c_buffer, az_lex_buffer->c_text, last );
-
- lex_filter_unprintable_chars (c_buffer, last, 0);
- c_buffer[ last ] = 0;
- _debug_output("%s \n", c_buffer);
-
- if (last_buffer)
- return;
- }
- }
- #endif
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function converts a null terminated string to a
- ** longword integer in the range 0..2**31-1. If the ascii value is
- ** outside that range, the external variable errno is set to ERANGE
- ** and the value returned is 2**31-1
- **
- ** FORMAL PARAMETERS:
- **
- ** c_text null terminate string holding integer in ascii
- **
- ** IMPLICIT INPUTS:
- **
- ** none
- **
- ** IMPLICIT OUTPUTS:
- **
- ** errno set if overflow occurs
- **
- ** FUNCTION VALUE:
- **
- ** long integer value of c_text
- **
- ** SIDE EFFECTS:
- **
- ** none
- **
- **--
- **/
- #define k_max_int 2147483647
- #define k_max_div_10 214748364
- long cvt_ascii_to_long(c_text)
- unsigned char XmConst *c_text;
- {
- unsigned long l_value;
- int pos;
- l_value = 0;
- for (pos = 0; c_text[ pos ] != 0; pos++)
- {
- if (l_value >= k_max_div_10)
- goto potential_overflow;
- l_value = (l_value * 10) + c_text[ pos ] - '0';
- }
- return l_value;
- potential_overflow:
- if (l_value > k_max_div_10)
- {
- errno = ERANGE;
- return k_max_int;
- }
- l_value = (l_value * 10) + c_text[ pos ] - '0';
- if (l_value > k_max_int)
- {
- errno = ERANGE;
- return k_max_int;
- }
- return l_value;
- }
- /*
- **++
- ** FUNCTIONAL DESCRIPTION:
- **
- ** This function creates a symbol entry for a primitive string.
- **
- ** FORMAL PARAMETERS:
- **
- ** l_size number of bytes to allocate
- ** l_charset charset of the string (token value)
- ** az_charset_entry charset of the string (symbol table value entry)
- **
- ** IMPLICIT INPUTS:
- **
- ** yylval
- **
- ** IMPLICIT OUTPUTS:
- **
- ** none
- **
- ** FUNCTION VALUE:
- **
- ** symbol node created
- **
- ** SIDE EFFECTS:
- **
- ** none
- **
- **--
- **/
- sym_value_entry_type *create_str_entry (l_size, l_charset, az_charset_entry)
- int l_size;
- int l_charset;
- sym_value_entry_type *az_charset_entry;
-
- {
- sym_value_entry_type *node;
- int charset; /* from sym_k_..._charset */
- unsigned char direction; /* writing direction */
- /*
- * Determine character set and writing direction
- */
- if (l_charset != lex_k_userdefined_charset)
- {
- charset = sem_map_subclass_to_charset( l_charset );
- direction = charset_writing_direction_table[charset];
- }
- else
- {
- charset = sym_k_userdefined_charset;
- direction = az_charset_entry->b_direction;
- }
-
- /* size of entry
- * sym_k_value_entry for common part of a value entry
- * l_size for the string
- * 1 for the null on string
- */
- node = (sym_value_entry_type *)
- sem_allocate_node
- ( sym_k_value_entry,
- sym_k_value_entry_size );
- node->value.c_value = XtCalloc(1, l_size + 1);
- node->header.az_src_rec = yylval.az_source_record;
- node->header.b_src_pos = yylval.b_source_pos;
- node->header.b_end_pos = yylval.b_source_end;
- node->b_type = sym_k_char_8_value;
- node->w_length = l_size;
- node->b_charset = charset;
- node->b_direction = direction;
- node->az_charset_value = az_charset_entry;
- node->obj_header.b_flags = sym_m_private | sym_m_builtin;
- return node;
- }
|