Commit Graph

283 Commits

Author SHA1 Message Date
1efd77acfe Partially implemented operator phrase commands 2022-09-03 11:34:13 -04:00
c2a8c4cd97 Added new token kind slices to func.go 2022-09-03 00:40:56 -04:00
b220f3dab5 Definition arguments are now parsed correctly 2022-09-03 00:17:25 -04:00
689200085a Putting pointers in interfaces is incredibly stupid 2022-09-03 00:01:01 -04:00
dbbe0198d5 Phrases in functions are now ToString'd 2022-09-02 23:38:30 -04:00
eee50dc9b0 Added argument level phrase parsing 2022-09-02 22:43:48 -04:00
44021fe875 Added some primitive phrase parsing 2022-09-02 22:37:52 -04:00
fccb67e5c0 Added basic func section ToString 2022-09-02 02:36:14 -04:00
ed44795664 Lexer now rejects strange chars in integer literals 2022-09-02 01:37:58 -04:00
ac7074a819 Added support for "external" keyword 2022-09-02 01:25:22 -04:00
08f111ccbf Various fixes to function parsing
- Newlines are handled better
- Types are actually parsed
2022-09-01 22:10:57 -04:00
bcb1b9b6d2 parseFuncSection calls parseFuncArguments now 2022-09-01 21:43:56 -04:00
8ccfc935ab Test logs error even if tree is nil 2022-09-01 21:37:15 -04:00
fcfa672652 Cleaned some go vet warnings 2022-09-01 18:40:51 -04:00
f585e5119f Removed useless logging in objt sections 2022-09-01 18:03:01 -04:00
aec266a82e Fail test on nil tree 2022-09-01 18:02:14 -04:00
8d46188f6c Throw an error on malformed func arguments list 2022-09-01 17:55:57 -04:00
5371c0eeae Added untested parsing of function arguments 2022-09-01 17:42:56 -04:00
7deacff330 AST supports function output default values 2022-09-01 17:13:40 -04:00
65c213f1f3 Fixed import paths 2022-08-30 01:11:10 -04:00
c3b6330b22 Added base function parsing 2022-08-25 20:01:12 -04:00
723b506005 Added test code for function sections 2022-08-25 16:08:18 -04:00
Sasha Koshka
e630ec6f04 Added function section to tree 2022-08-25 12:02:43 -04:00
Sasha Koshka
b7631530bc yeah 2022-08-24 23:54:06 -04:00
Sasha Koshka
fa1d8efe55 Its just as I feared. Identifier parsing doesn't work! 2022-08-24 23:50:16 -04:00
Sasha Koshka
89a60e620e Altered objt section test case to not be alphabetically organized 2022-08-24 20:20:55 -04:00
Sasha Koshka
cd528552c8 Object sections now parse members into array 2022-08-24 20:19:14 -04:00
Sasha Koshka
067bf2f4df Altered tree so that object members are stored in an array 2022-08-24 20:09:57 -04:00
c470997887 Did the same thing to interfaces 2022-08-24 18:57:07 -04:00
715766edb4 Objects can only inherit by specifiying an identifier 2022-08-24 18:52:31 -04:00
e316eb7791 Changed bit field syntax to use an & symbol 2022-08-24 18:37:44 -04:00
731cc828ce Added untested bit width parsing 2022-08-24 18:29:15 -04:00
05aa0e6177 Added bitfields to object section test case 2022-08-24 18:23:11 -04:00
fb43f96acc Added bit fields to tree and ToString for object member 2022-08-24 18:22:47 -04:00
Sasha Koshka
b64fbd9fc4 Split tests into multiple files
This should make it easier to work on sections independantly of one another
without creating merge conflicts
2022-08-24 01:22:24 -04:00
Sasha Koshka
0d366964ca Enum members are now ordered 2022-08-24 01:16:44 -04:00
Sasha Koshka
0b80a55f79 Repaired output formatting of interface section 2022-08-24 00:53:42 -04:00
Sasha Koshka
08935d69c0 Parser actually adds interface behavior to interface 2022-08-24 00:52:37 -04:00
Sasha Koshka
39f8d7e4ac Fixed parsing of interface section behaviors 2022-08-24 00:25:52 -04:00
Sasha Koshka
1f88b54eaa Face sections are actually ToString'd now 2022-08-23 22:25:21 -04:00
b0d4ecc83f Added interface section parsing to body 2022-08-23 15:14:44 -04:00
4eac5c67aa Added untested interface section parsing 2022-08-23 15:13:00 -04:00
441b036a1c Updated test case to reflect previous commit 2022-08-23 14:07:56 -04:00
8817d72cb3 Interfaces can inherit other interfaces 2022-08-23 13:56:59 -04:00
3ef1e706b3 Added ToString method to face section 2022-08-23 13:54:44 -04:00
944fc8514e Add correct output for face test case 2022-08-23 13:46:20 -04:00
Sasha Koshka
cd55a0ad8d Add interface section to tree 2022-08-23 10:56:37 -04:00
Sasha Koshka
c29efd97ba Organized test case members alphabetically 2022-08-23 01:36:40 -04:00
Sasha Koshka
aa84d9a429 Removed space alignment and hex literals from test case check
ToString is not capable of producing this
2022-08-23 01:35:35 -04:00
Sasha Koshka
5dcf3b3d1a Fixed ToString formatting of enum 2022-08-23 01:33:28 -04:00
Sasha Koshka
d8074fa5cb Enum default values are now parsed properly
Previously the parser would stay on the member name and parse it the default
value. It now moves forward and catches the actual default value.
2022-08-23 01:30:56 -04:00
Sasha Koshka
6a6fe8353e Add untested enum parsing 2022-08-21 11:17:56 -04:00
Sasha Koshka
c4f763af5b Added test case for enum section 2022-08-21 02:48:36 -04:00
Sasha Koshka
6fbda34300 Add base enum parsing method 2022-08-21 02:42:25 -04:00
Sasha Koshka
59126f60cc Added enum sections to tree 2022-08-21 02:40:04 -04:00
Sasha Koshka
f3b2d11f59 I swear its not my code thats wrong its the test
No like literally this keeps happening
2022-08-20 15:45:45 -04:00
Sasha Koshka
3900bbe7bf Parser test cases now print out line numbers 2022-08-20 15:45:01 -04:00
Sasha Koshka
b878017b81 The last item of object sections is now saved. 2022-08-20 15:22:25 -04:00
Sasha Koshka
5271876196 Changed data in object test to use objt keyword instead of type 2022-08-20 13:46:10 -04:00
Sasha Koshka
617d76fc46 Object sections now parse properly 2022-08-20 13:43:10 -04:00
Sasha Koshka
0ceaedbcd8 Object sections now ToString properly 2022-08-20 13:42:09 -04:00
Sasha Koshka
edb9c1a0b6 Fixed assignment to entry in nil map 2022-08-20 13:29:04 -04:00
Sasha Koshka
bd433fc65d Untested object section parsing 2022-08-20 13:26:24 -04:00
Sasha Koshka
c847d2187d Fixed the object section test 2022-08-20 13:25:43 -04:00
Sasha Koshka
cb2264977a Added object sections to the tree for real lol 2022-08-20 13:24:56 -04:00
Sasha Koshka
790e7e632e Removed recursive member parsing nonsense from type section 2022-08-20 12:50:32 -04:00
Sasha Koshka
fc1568aece Updated ToString methods to match new tree structure 2022-08-20 12:40:44 -04:00
Sasha Koshka
222c47ced9 Altered tree to separate object and blind type definitions 2022-08-20 02:46:40 -04:00
Sasha Koshka
da6d587a48 Split test cases between blind types and objt types 2022-08-20 02:42:52 -04:00
Sasha Koshka
78b8b9dacd Fixed test case for parser
The correct output string was missing a type specifier. The lexer now passes
this test.
2022-08-19 11:37:30 -04:00
Sasha Koshka
2605d1fb09 Fixed nested complex initialization values not parsing 2022-08-19 11:36:30 -04:00
Sasha Koshka
9dce9b2f75 Fixed test formatting 2022-08-19 03:05:25 -04:00
Sasha Koshka
9b4279c052 Fixed ToString of type nodes 2022-08-19 03:03:36 -04:00
Sasha Koshka
2296765e81 Added recursive parsing of type nodes 2022-08-19 03:01:47 -04:00
Sasha Koshka
19d0b3f455 Complex default values of type nodes now ToString properly 2022-08-19 02:36:56 -04:00
Sasha Koshka
e25e7bdf14 Parser can now parse array and object initializations 2022-08-19 02:34:17 -04:00
Sasha Koshka
63419165dd Moved most of type section parsing into reusable type node parsing method 2022-08-19 02:08:18 -04:00
Sasha Koshka
69aaae8f14 Restructured type definitions to use a node tree 2022-08-18 23:38:32 -04:00
Sasha Koshka
717474a59e Removed unnescessary println statements (oopsie) 2022-08-18 20:09:27 -04:00
Sasha Koshka
ef90115a1b Fixed some test case formatting 2022-08-18 20:09:04 -04:00
Sasha Koshka
cced825f74 Changed this one thing to the other thing 2022-08-18 19:40:35 -04:00
Sasha Koshka
9fd3fb1263 Added basic ToString method to TypeSection 2022-08-18 17:45:34 -04:00
Sasha Koshka
5c2a7aeb07 Created base for type section parsing 2022-08-18 17:39:19 -04:00
Sasha Koshka
bc9beb0317 Created test case for type section 2022-08-18 16:56:42 -04:00
Sasha Koshka
a548dcc585 Changed permission codes to only determine private/public/readonly
Changing permissions within the module was redundant and would have just
conflicted with the :mut type qualifier. This is easier to understand.
2022-08-18 12:09:17 -04:00
Sasha Koshka
39e4fbe844 Replaced references to file.Error with infoerr.Error 2022-08-18 00:58:40 -04:00
Sasha Koshka
63110d9a32 Removed bad spacing in ObjectInitializationValues.ToString
If a value had more initialzation values inside of it, it would leave a space
before the newline. This was causing the parser test to believe the parser to be
failing. The parser now passes the test.
2022-08-17 19:40:16 -04:00
Sasha Koshka
6a5851c9eb Parser tests now show exact line and column where data is mismatched 2022-08-17 19:36:33 -04:00
Sasha Koshka
d78f150336 Removed data test case initializing pointers with phrases
Phrase parsing is out of scope for this branch. It will be implemented at the
same time as function parsing.
2022-08-17 14:16:54 -04:00
Sasha Koshka
e5b92009f0 Re-arranged data parsing test case to be alphabetical 2022-08-17 13:53:08 -04:00
Sasha Koshka
98fb4e9c66 In ToString methods, maps are sorted alphabetically before output
This makes the output of ToString methods deterministic, and as such they can be
used for testing.
2022-08-17 13:50:33 -04:00
Sasha Koshka
aee90757e3 Object initialization value parsing is now done recursively 2022-08-17 13:26:18 -04:00
Sasha Koshka
31bb36a4f7 Reworked parsing object initialization values 2022-08-17 12:53:35 -04:00
Sasha Koshka
384de58d41 Added previousToken method to parser 2022-08-17 12:39:26 -04:00
Sasha Koshka
8c03aa880b Reworked array initialization value parsing 2022-08-17 11:30:17 -04:00
Sasha Koshka
7bb6582e01 Added default nil argument kind 2022-08-17 01:07:12 -04:00
Sasha Koshka
0ad1c0b2f4 Fixed extraneous newlines after complex initialization values 2022-08-17 01:04:52 -04:00
Sasha Koshka
9ca1be2204 Fixed array initialization value parsing 2022-08-17 00:55:53 -04:00
Sasha Koshka
0dd9368393 Reworked data section so it stores single initialization argument 2022-08-17 00:49:49 -04:00
Sasha Koshka
bd42c95de0 Parser can now sort of parse object member initialization values 2022-08-17 00:14:55 -04:00
Sasha Koshka
bd456b72e9 Argument.ToString can now recover on nil interface value 2022-08-17 00:13:14 -04:00
Sasha Koshka
eb3fb65c9b Changed object initialization values to be a map 2022-08-16 23:45:25 -04:00
Sasha Koshka
bb2948d397 Added parsing array initialization values 2022-08-16 21:31:23 -04:00
Sasha Koshka
210e527b3a parseType method now understands arrays with undefined length 2022-08-16 20:55:43 -04:00
Sasha Koshka
97cb6e54eb Type.ToString now understands array lengths 2022-08-16 20:53:27 -04:00
Sasha Koshka
9e01eef45b Added elipsis token 2022-08-16 20:24:27 -04:00
Sasha Koshka
efb3bbe21b Added base for parsing initialization values 2022-08-16 20:10:47 -04:00
Sasha Koshka
c172c111d8 Rethought how object and array literals will work 2022-08-16 17:45:31 -04:00
Sasha Koshka
16bca57e36 Fixed numerous problems related to type parsing 2022-08-16 17:21:10 -04:00
Sasha Koshka
5e2d8c9955 Parser can now ToString data sections properly 2022-08-16 16:37:20 -04:00
Sasha Koshka
5c23c59c92 Added parsing primitive arguments 2022-08-16 16:27:52 -04:00
Sasha Koshka
0025d03a18 Modified parser data test to have uninitialized pointer cases 2022-08-16 16:16:39 -04:00
Sasha Koshka
45bc798d19 Added identifier and declaration parsing 2022-08-16 15:53:32 -04:00
Sasha Koshka
9cb2f68581 Argument kind is now called .kind instead of .what 2022-08-16 15:50:34 -04:00
Sasha Koshka
4dfb327558 Add subscript and dereference argument kinds 2022-08-16 13:43:36 -04:00
Sasha Koshka
f978621673 Parse basic information about data sections (name, type) 2022-08-16 10:44:02 -04:00
Sasha Koshka
ac40fa96e5 Improved parser test
Created new cases involving mutable data and phrase initialization arguments,
and always print out the correct and parsed trees.
2022-08-16 01:55:22 -04:00
Sasha Koshka
85b7938843 ParseBody now has a loop, and errors on unrecognized section type 2022-08-15 21:20:13 -04:00
Sasha Koshka
e42bad5810 Identifiers can no longer have arguments in them
Previously [[something something].something] would have been syntactically
correct. This can lead to ugly and cluttered syntax due to violating the one
thing per line guideline (that I've forgotten to write down) and would make the
parser incredibly convoluded. Member selection in arf is not an operator and
should not be treated as such. It would be much better to just use variables for
this.
2022-08-15 17:05:57 -04:00
Sasha Koshka
614b5664fc Parser calls ParseDataSection 2022-08-15 15:09:07 -04:00
Sasha Koshka
3a3c588023 Added data test 2022-08-15 14:23:53 -04:00
Sasha Koshka
00bcfaab0b Parser tests now work by checking the ToString() of the parsed tree 2022-08-15 14:17:29 -04:00
Sasha Koshka
d91423863b Added ToString methods for syntax tree nodes 2022-08-15 14:04:57 -04:00
Sasha Koshka
b02ff6cda6 Created structs needed to represent a data section 2022-08-15 01:47:42 -04:00
Sasha Koshka
0a067524ce Added base parse body function 2022-08-14 22:38:57 -04:00
714aca5196 Fix parseMeta not getting enough tokens
Parser now passes TestMeta
2022-08-12 17:12:38 -05:00
033e64fc54 Parser can now print out a list of expected token kinds 2022-08-12 17:09:37 -05:00
f23c3a234a Added metadata parser 2022-08-12 16:22:51 -05:00
050c956787 Added expect and nextToken methods to parser 2022-08-12 13:33:21 -05:00
18bd681082 Parser now understands the separation between files
This needs to be done because each file has a metadata section at the top.
2022-08-12 12:02:20 -05:00
2019c67bbb Created basic test for parser 2022-08-12 11:55:17 -05:00
81b47f7734 Replaced all occurences of github.com with git.tebibyte.media 2022-08-12 10:21:36 -05:00
09170e390d Created base for parser
The parser now handles file opening and invokes the lexer.
2022-08-12 10:11:43 -05:00