Commit graph

334 commits

Author SHA1 Message Date
Wolfgang (Blub) Bumiller
613e1e7247 Change the parser to use the hashtable functions 2012-11-25 13:23:37 +01:00
Dale Weiler
5c0a62be96 Add respective license headers + some cleanups 2012-11-24 21:22:35 +00:00
Wolfgang (Blub) Bumiller
86f3ef2194 turn the message about global variable double-declaration into a warning instead of an error on std != gmqcc 2012-11-23 22:30:35 +01:00
Wolfgang (Blub) Bumiller
39b8b6a660 warn about double function declarations... 2012-11-23 22:22:22 +01:00
Wolfgang (Blub) Bumiller
2bc99076cf 'var' is now no keyword anymore, :\ 2012-11-23 22:07:35 +01:00
Wolfgang (Blub) Bumiller
1c7e9c5fde handling 'const' - still need correct separation of constant and just initialized later when we distinguish between them 2012-11-23 21:52:16 +01:00
Wolfgang (Blub) Bumiller
6df6906ed2 Adding an unrecognized keywords error 2012-11-23 21:41:50 +01:00
Wolfgang (Blub) Bumiller
0d33939b1b operator &~= 2012-11-23 14:39:05 +01:00
Wolfgang (Blub) Bumiller
122e80cc4d operators &= and |= 2012-11-23 14:28:11 +01:00
Wolfgang (Blub) Bumiller
553f3df5df *= and /= operators 2012-11-23 14:24:58 +01:00
Wolfgang (Blub) Bumiller
1223e04e05 correcting an error message 2012-11-23 12:28:51 +01:00
Wolfgang (Blub) Bumiller
f22f1af891 Suffix operators, and remembering the const-float-1 in parser_t 2012-11-23 12:25:13 +01:00
Wolfgang (Blub) Bumiller
4079835c7e Parsing of suffix operators, NOTE: applied like prefix operators just to get it committed in a compilable state 2012-11-23 11:57:08 +01:00
Wolfgang (Blub) Bumiller
38f5090778 Prefix ++,-- 2012-11-23 11:52:03 +01:00
Wolfgang (Blub) Bumiller
9a43eb6370 a type_name -> ast_type_to_string conversion 2012-11-23 11:45:22 +01:00
Dale Weiler
c748293ccb Use memcmp for comparing doubles 2012-11-23 06:41:06 +00:00
Dale Weiler
b5507b3127 Make it compile with -Wall and -pedantic 2012-11-23 02:23:22 +00:00
Wolfgang (Blub) Bumiller
905ca8819b unused params in parser.c 2012-11-22 21:44:09 +01:00
Wolfgang (Blub) Bumiller
dfde3a583c Remove unused macro 2012-11-22 21:10:37 +01:00
Wolfgang (Blub) Bumiller
07d5686a47 Fixing shadows in parser.c - moving generate_checksum over the static parser global 2012-11-22 20:47:46 +01:00
Wolfgang (Blub) Bumiller
6983142c4d -dump vs -dumpfin; to see the IR before and after finalizing functions 2012-11-21 21:53:38 +01:00
Wolfgang (Blub) Bumiller
9c8dc43775 error if the ternary operands aren't of the same type - except for the first one of course 2012-11-21 20:56:51 +01:00
Wolfgang (Blub) Bumiller
0787038934 check 'ternaries' count 2012-11-21 20:50:27 +01:00
Wolfgang (Blub) Bumiller
90bd91e294 Utilizing vec_last more 2012-11-21 20:44:43 +01:00
Wolfgang (Blub) Bumiller
55c2148016 operator handling for ternary 2012-11-21 20:41:26 +01:00
Wolfgang (Blub) Bumiller
11f1af78d5 Removing some obsolete messages 2012-11-21 20:40:10 +01:00
Wolfgang (Blub) Bumiller
e0ddf32d2e parsing the ternary 2012-11-21 20:36:42 +01:00
Wolfgang (Blub) Bumiller
f4043faf0b -frelaxed-switch to enable switch on non-constant cases 2012-11-19 22:27:58 +01:00
Wolfgang (Blub) Bumiller
4649c12fa9 Parsing of switches 2012-11-19 22:06:29 +01:00
Wolfgang (Blub) Bumiller
b72900214b fix a warning and remove unused variables 2012-11-19 19:44:26 +01:00
Wolfgang (Blub) Bumiller
ea75003cf4 break and continue support 2012-11-19 19:39:52 +01:00
Wolfgang (Blub) Bumiller
2d8bf20d43 moving 'return' parsing into a function 2012-11-19 19:22:00 +01:00
Wolfgang (Blub) Bumiller
f023004a67 Make functions copy their extparams 2012-11-18 20:06:28 +01:00
Wolfgang (Blub) Bumiller
e8d1e5dbc0 Make the >8 parameter message a warning 2012-11-18 19:19:38 +01:00
Wolfgang (Blub) Bumiller
0330b082a2 The ftepp now always outputs into a string buffer, with -E the buffer will be dumped to stdout or the via -o specified file, without -E it'll be passed to the parser to be compiled 2012-11-18 13:33:53 +01:00
Wolfgang (Blub) Bumiller
f0d56d07fe Merge branch 'master' into ftepp 2012-11-18 13:06:29 +01:00
Wolfgang (Blub) Bumiller
cec58b53e4 Collect accessor functions in the parser so they can later be deleted, fixed that leak 2012-11-18 13:06:16 +01:00
Wolfgang (Blub) Bumiller
f47a20aa53 Removing some code duplication 2012-11-18 13:00:18 +01:00
Wolfgang (Blub) Bumiller
2b65ea599f Some printf/con_out/con_err conversions, guarded some outputs with not-opts_pp_only so the -E switch can print to stdout normally 2012-11-18 11:43:46 +01:00
Wolfgang (Blub) Bumiller
906f319673 Replaced it all... 2012-11-15 18:32:09 +01:00
Dale Weiler
2e84cc0b41 Use new console system everywhere. 2012-11-15 00:28:46 +00:00
Wolfgang (Blub) Bumiller
84088cb5f0 Merging in new-syntax 2012-11-14 21:39:16 +01:00
Dale Weiler
f0750209b7 preliminary segregated console subsystem 2012-11-14 19:17:43 +00:00
Wolfgang (Blub) Bumiller
f3ebbf598f if not() support 2012-11-13 18:55:55 +01:00
Wolfgang (Blub) Bumiller
e7d558dbd8 if not() support 2012-11-13 18:54:25 +01:00
Wolfgang (Blub) Bumiller
51ba2c49d6 improve the warning 2012-11-13 14:46:14 +01:00
Wolfgang (Blub) Bumiller
b1175eabfc Warn (via -Wextensions) when accessing a field-of-array's element without putting the indexed field name in parenthesis 2012-11-13 14:43:20 +01:00
Wolfgang (Blub) Bumiller
b0326c66ed when finishing an array-indexing operation the parser now calls rotate_entfield_array_index_nodes to fixup 'ent.foo[n]' to become 'ent.(foo[n])' 2012-11-13 00:39:39 +01:00
Wolfgang (Blub) Bumiller
d60a76abd1 allowing inexing of array-fields 2012-11-12 23:35:47 +01:00
Wolfgang (Blub) Bumiller
dbdcdb059e array-field setter needs to use STOREP* 2012-11-12 23:05:44 +01:00
Wolfgang (Blub) Bumiller
0340a6a6e7 support for ast_entfield nodes with specific output types, fixing array-field instantiating code to print the correct name on error 2012-11-12 22:39:43 +01:00
Wolfgang (Blub) Bumiller
89d86420ad entity-array-field-setter generation 2012-11-12 22:31:54 +01:00
Wolfgang (Blub) Bumiller
3579e495be code to instantiate field-array accessors 2012-11-12 22:24:11 +01:00
Wolfgang (Blub) Bumiller
0de1ebbc21 Preparing to generate accessors for field arrays 2012-11-12 22:16:18 +01:00
Wolfgang (Blub) Bumiller
f026ca2fc5 more factorizing and shortening of code 2012-11-12 21:12:25 +01:00
Wolfgang (Blub) Bumiller
c18c89cd62 shorten some code 2012-11-12 20:51:12 +01:00
Wolfgang (Blub) Bumiller
83438d9833 call ir_function_finalize on array accessors otherwise they'll blow up stuff 2012-11-11 23:46:03 +01:00
Wolfgang (Blub) Bumiller
511058c018 handling of op-[ 2012-11-11 18:54:08 +01:00
Wolfgang (Blub) Bumiller
d5b95f0412 Handling [ in the SYA 2012-11-11 18:45:43 +01:00
Wolfgang (Blub) Bumiller
2994d308a0 array index opening-paren can now return TOKEN_OPERATOR, partially handled in SYA 2012-11-11 16:43:16 +01:00
Wolfgang (Blub) Bumiller
533f9f2cfc SY_PAREN_ constants to replace magic numbers 2012-11-11 16:36:20 +01:00
Wolfgang (Blub) Bumiller
1ab303c528 Store accessors in the ast_value for access from within the ast - generate accessors after generating all the globals to not mess up the order of globals in the output 2012-11-11 16:22:09 +01:00
Wolfgang (Blub) Bumiller
7d9568f806 array accessor function genaration 2012-11-11 16:06:27 +01:00
Wolfgang (Blub) Bumiller
9324a96f77 properly in all situations where an array is part of a function's return type 2012-11-11 14:17:48 +01:00
Wolfgang (Blub) Bumiller
86e42ad123 Don't allow arrays and other unsupported parameter types to be used in parameter lists 2012-11-11 14:08:02 +01:00
Wolfgang (Blub) Bumiller
df77e062dc Starting to add error messages for when using array types in expressions 2012-11-11 12:32:47 +01:00
Wolfgang (Blub) Bumiller
fb264b90b9 need to use ast_unref rather than ast_delete on the parsed array-size otherwise we end up deleting constants 2012-11-11 12:13:34 +01:00
Wolfgang (Blub) Bumiller
cf1ea01de3 parser_compile_file vs parser_compile_string 2012-11-11 10:33:29 +01:00
Wolfgang (Blub) Bumiller
00a28e48ee parse arrays 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
2cb15e8c2d first parsing of [ - pushing temp changes 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
1869440fd9 Preparing to parse arrays: adding TYPE_ARRAY and union/struct TYPE_ constants to be consistent with fteqcc, filled type-arrays with their data, attempting to parse an array variable and added some error messages to the IR in case of unhandled types 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
c87b056fdc Support non-const initialized locals 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
8687aa9a3e Shouldn't require a 'local' keyword for local fieldpointers 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
a27750966f globals of type .vector will now properly generate 3 globals 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
52daf02444 Support in the AST for TYPE_FIELD globals which are no actual fields 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
fe05d5afd9 added 'var' to the keywords when not in -std=qcc, supporting 'var .float x;' in global-scope to declare a field-pointer variable without creating a field of that name 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
76b21ad192 -std=qcc now errors on C-style function syntax 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
0bb90f284e -std=qcc should error when the '=' is missing in a function declaration before the body 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
0fc3a0c517 Removing old commented-out parsing code 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
016257c44e Making the = in front of function bodies optional 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
7f4047381e new-style syntax 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
e87fd30c48 Enable 'local-already-declared' check for locals even when they are functions - this was previously simply in the wrong 'if' 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
8e30d7cb86 fixing a stupid typo - why doesn't any compiler warn about this crap 2012-11-11 10:12:45 +01:00
Wolfgang (Blub) Bumiller
9141217481 Merged parsing of variable and field declarations into 1 function 2012-11-09 19:10:27 +01:00
Wolfgang (Blub) Bumiller
e143db0cae gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface> 2012-11-04 11:41:44 +01:00
Wolfgang (Blub) Bumiller
5ff0013357 error on more than 8 params for now since more need special treatment 2012-11-02 22:51:26 +01:00
Wolfgang (Blub) Bumiller
2fa544f681 Error when trying to assign variables whose types are different - with -std=qcc only warn when they are both functions with non-matching parameter types 2012-10-28 20:32:13 +01:00
Wolfgang (Blub) Bumiller
cd8043fc18 a failing 'parse-statement' call should not print 'parse error' at all since at that point more descriptive error message has to have been printed already 2012-10-28 15:53:30 +01:00
Wolfgang (Blub) Bumiller
634a544dca The proper way to deal with error messages which did not cause the parser to bail out early is this, not a 'parse error'-error... 2012-10-28 15:48:51 +01:00
Wolfgang (Blub) Bumiller
478a9249a0 add error for function parameters of invalid types 2012-10-28 15:44:27 +01:00
Wolfgang (Blub) Bumiller
201bfb9803 When erroring while parsing a function and the function had been added to the parser's function list, remove it, otherwise it'll get freed again in the parser's cleanup function 2012-10-28 15:28:39 +01:00
Wolfgang (Blub) Bumiller
5dd8e23dfd Cleaner crc implementation 2012-10-02 17:51:03 +02:00
Wolfgang (Blub) Bumiller
354dd94b95 Generating checksums 2012-10-02 17:09:49 +02:00
Wolfgang (Blub) Bumiller
9d70c3a56e Print a warning if end_sys_fields was declared as a field rather than a global 2012-10-02 15:59:37 +02:00
Wolfgang (Blub) Bumiller
4742ee9123 don't warn about unused end_sys_{globals,fields} 2012-10-02 15:35:43 +02:00
Wolfgang (Blub) Bumiller
ab91dea4e0 the lexer now doesn't _allocate_ the token structure, also: the vector holding the token doesn't shrink so we have much fewer reallocations 2012-08-24 17:37:55 +02:00
Wolfgang (Blub) Bumiller
20b8a191b1 parse_variable refactored, moved out the parsing of function bodies, easier memory handling 2012-08-24 17:23:47 +02:00
Wolfgang (Blub) Bumiller
e1155eebc2 renaming some parser functions, mainly shortining things: parse_type just looks much better than parser_parse_type... 2012-08-24 15:34:48 +02:00
Wolfgang (Blub) Bumiller
50e76a56c5 Adding static keyword to some more parser functions 2012-08-24 15:27:41 +02:00
Wolfgang (Blub) Bumiller
02512f21f2 create_vector_members sanitized 2012-08-24 15:09:51 +02:00