Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/contrib/good/yabasic.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #ifndef YABASIC_H | |
2 #define YABASIC_H | |
3 | |
4 typedef union { | |
5 double alignment; | |
6 char ag_vt_2[sizeof(int)]; | |
7 char ag_vt_4[sizeof(double)]; | |
8 char ag_vt_5[sizeof(char *)]; | |
9 } parseBasic_vs_type; | |
10 | |
11 typedef enum { | |
12 parseBasic_white_space_token = 1, parseBasic_SEP_token = 7, | |
13 parseBasic_simple_real_token = 14, parseBasic_exponent_token = 18, | |
14 parseBasic_integer_part_token = 20, parseBasic_fraction_part_token = 22, | |
15 parseBasic_letter_token = 25, parseBasic_SYMBOL_token = 27, | |
16 parseBasic_DIGITS_token = 29, parseBasic_string_text_token = 31, | |
17 parseBasic_program_token = 34, parseBasic_statement_list_token, | |
18 parseBasic_eof_token, parseBasic_statement_token, parseBasic_label_token, | |
19 parseBasic_string_assignment_token = 40, parseBasic_assignment_token, | |
20 parseBasic_for_loop_token, parseBasic_if_clause_token, | |
21 parseBasic_symbol_or_lineno_token = 45, parseBasic_expression_token = 51, | |
22 parseBasic_goto_list_token = 53, parseBasic_gosub_list_token = 55, | |
23 parseBasic_hashed_number_token = 57, | |
24 parseBasic_string_expression_token = 59, parseBasic_printintro_token = 62, | |
25 parseBasic_printlist_token, parseBasic_semicolon_token = 65, | |
26 parseBasic_inputintro_token = 67, parseBasic_inputlist_token, | |
27 parseBasic_readlist_token = 70, parseBasic_datalist_token = 72, | |
28 parseBasic_dimlist_token = 76, parseBasic_mapping_token = 79, | |
29 parseBasic_indexlist_token = 107, | |
30 parseBasic_primary_string_expression_token = 114, | |
31 parseBasic_string_function_token, | |
32 parseBasic_primary_expression_token = 129, parseBasic_function_token, | |
33 parseBasic_exponential_expression_token = 132, | |
34 parseBasic_multiplicative_expression_token = 134, | |
35 parseBasic_const_token = 159, parseBasic_intnum_token, | |
36 parseBasic_step_part_token = 167, parseBasic_next_or_eofile_token = 170, | |
37 parseBasic_next_symbol_token, parseBasic_condition_token = 175, | |
38 parseBasic_else_part_token = 179, parseBasic_endif_or_eof_token = 181, | |
39 parseBasic_and_condition_token = 183, | |
40 parseBasic_primary_condition_token = 185, | |
41 parseBasic_comparison_token = 187, parseBasic_input_token = 195, | |
42 parseBasic_readitem_token = 198, parseBasic_stream_token = 201, | |
43 parseBasic_position_token, parseBasic_prompt_token = 204, | |
44 parseBasic_name_token = 216, parseBasic_digit_string_token, | |
45 parseBasic_STRSYM_token = 257, parseBasic_STRING_token = 262, | |
46 parseBasic_number_token = 274, parseBasic_digit_token = 324 | |
47 } parseBasic_token_type; | |
48 | |
49 typedef struct parseBasic_pcb_struct{ | |
50 parseBasic_token_type token_number, reduction_token, error_frame_token; | |
51 int input_code; | |
52 int input_value; | |
53 int line, column; | |
54 int ssx, sn, error_frame_ssx; | |
55 int drt, dssx, dsn; | |
56 int ss[128]; | |
57 parseBasic_vs_type vs[128]; | |
58 int ag_ap; | |
59 const char *error_message; | |
60 char read_flag; | |
61 char exit_flag; | |
62 int bts[128], btsx; | |
63 int lab[10], rx, fx; | |
64 const unsigned char *key_sp; | |
65 int save_index, key_state; | |
66 char ag_msg[82]; | |
67 } parseBasic_pcb_type; | |
68 | |
69 #ifndef PRULE_CONTEXT | |
70 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
71 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
72 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
73 #endif | |
74 | |
75 #ifndef AG_RUNNING_CODE | |
76 /* PCB.exit_flag values */ | |
77 #define AG_RUNNING_CODE 0 | |
78 #define AG_SUCCESS_CODE 1 | |
79 #define AG_SYNTAX_ERROR_CODE 2 | |
80 #define AG_REDUCTION_ERROR_CODE 3 | |
81 #define AG_STACK_ERROR_CODE 4 | |
82 #define AG_SEMANTIC_ERROR_CODE 5 | |
83 #endif | |
84 | |
85 extern parseBasic_pcb_type parseBasic_pcb; | |
86 void init_parseBasic(void); | |
87 void parseBasic(void); | |
88 #endif | |
89 |