Commit Graph

344 Commits

Author SHA1 Message Date
2330b87c0f
Target.hpp: Add a "use_uniqueLineSeparator" virtual function
Js.hpp: override the new virtual function to always output semicolons

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:11 +02:00
97a9703a1a
Lua.hpp & Js.hpp: Don't insert new lines and indentation when a function is empty
Py.hpp: Support empty functions

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:11 +02:00
7df47da354
Fix the parsing of ParseTree to ignore previous parsed instances
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:11 +02:00
014ea9060b
ParserComponents.hpp: Add a "<<" operator overload (which takes a constant string reference as its argument) to the ParseTree class
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:11 +02:00
e32b2172e5
Use deca::num in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
3c4dc0ea28
Remove a useless break statement in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
8d239694cf
Remove the const specifier in the "begin" and "end" functions of ParseTree, since they call non-const functions
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
663979ea65
Fix allocation of more memory in the ParseTree.addAllComponents function
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
5d2b630ec6
Remove a TODO comment in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
e9d7c27d4f
Simplify parsing of functions/calls/classes and remove the Class.body variable
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
5a96757942
Always throw an error when an unexpected expression is found in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
453025b18c
Add an "empty" function to the ParseTree class
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
d059d1e507
Throw the "Unexpected character" error for all unrecognized characters in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:10 +02:00
27c8b642d6
Check if i is equal to zero instead of checking whether it is greater, since i is unsigned in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:09 +02:00
6945900140
main.cpp: Rename "currentArg" to "currentArgument"
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:08 +02:00
21137f5beb
Add a "--text" argument
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-21 23:31:02 +02:00
49dc7d0ebb
main.cpp: Use a map instead of a set and a vector in main.cpp
Target.hpp: make staticMap thread-local to avoid issues with the "--parallel" argument, and don't include dots in the languages array

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-08 19:45:00 +02:00
2b596e691c
Rename the "it" local variable to "closing" in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-08 12:46:56 +02:00
14b71906b7
Add a SEMICOLON token
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-04-08 11:01:16 +02:00
88d0774d30
Fix the precision of StandardComponents::types::Integer
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 18:17:58 +01:00
ca3b030fed
Delete the default constructor in Target.hpp and always initialize output
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 15:59:32 +01:00
db0ada09f6
Use powl instead of pow in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 15:52:09 +01:00
ce8e21ee25
Include cmath in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 15:37:13 +01:00
8a97def6b2
Add integer parsing
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 13:40:18 +01:00
adbe98ec00
Increment i after finding the end iterator when parsing variables
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-22 13:40:03 +01:00
01abadc1fa
Use cmp_less instead of cmp_greater in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-19 16:28:59 +01:00
3a75531664
Transpile arguments correctly in Target.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-19 13:09:51 +01:00
ba14e95d50
Add a separate_transpileTree overload and transpile function parameters correctly
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-19 12:40:52 +01:00
5f3c8d785d
Use to_address instead of the unique_ptr::get function in ParseTree::findById
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-17 16:44:04 +01:00
bee9917947
Use LPAR instead of a character in a condition of Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-17 15:49:03 +01:00
272323d091
Add two local variables to Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-17 15:47:03 +01:00
513c9a44a0
Re-add a variable to hold the current target in main.cpp, and capture it by value in the compile function
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-16 14:01:19 +01:00
1f819bc136
When parsing a function call, invoke parse without specialization since the "=" operator needs a ParseTree
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-13 22:35:18 +01:00
f21a79fb29
Include Yerbacon.hpp in filefuncs.cpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-13 15:39:40 +01:00
f3d03adead
Add functions, indentation, better variables parsing and more
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-13 15:15:29 +01:00
74c5904d21
Add a character cast operator to tok in lex.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-12 11:16:36 +01:00
2425d19f9f
Add a Parser::parse overload which takes input iterators as arguments
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-09 20:48:57 +01:00
8e7aaadbd0
Rename parseVector to parse in Parser.hpp, and make the parameter a span instead of a vector
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-09 19:31:30 +01:00
cca696b27a
Fix the line number of next in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-04 19:31:28 +01:00
26d88c2f91
Set line to 1 by default in the tok structure
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-04 19:25:29 +01:00
9d7300ce89
Fix errors by removing the isNotBlank boolean and using hasNext instead
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-04 19:19:13 +01:00
33e29ccb8e
Remove the tok default constructor in lex.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-01 20:16:29 +01:00
6955c5cb4d
Remove tok::type::EOF_ because it is useless, and fix the next local constant reference in Parser.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-03-01 20:14:47 +01:00
ec4121de1c
Fix parsing of parentheses by searching after the current index
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 16:03:34 +01:00
56e1db5fcc
Add a transpileTree function to Target.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
3c130529a4
Make the newLine constructor parameter a reference & add a "separator" member and a "uniqueLineSeparator" virtual method to Target.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
63b24752d6
Make the members of the tok structure non-const to avoid undefined behaviour when the "=" operator is called
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
beb28ef4ad
Rename the Yerbacon::exit function to Yerbacon::fail
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
de2259b6ed
Add a "inverseLCharacter" static function to tok
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
7cbb424416
Add a "unit_result" type alias to main.cpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
de2d936e19
Use dynamic_cast instead of reinterpret_cast in Target.hpp and ParseComponents.hpp, and extend the ParseComponent class virtually in the ParseTree and NamedIdentifier classes
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
68dc7ea1a1
Make Parser::parseVector a function template
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
c4f75a3b04
Make the constexpr ParseTree constructors inline instead
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
0b3109c989
Add a move assignment operator to ParseTree
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
a45902c9b2
Add an "at" function to ParseTree
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
1a37e35228
Add a component_ptr type definition to ParseComponents.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
ca4e773fca
Add an alternative "make_task_noR" macro to avoid making unused references in Target.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
f33aec687a
Parse Calls/ParseTrees
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
b5ff43e109
Remove a useless constructor in the ParseTree class
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
63b3d727a6
Add a newline to the output in Target.hpp
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
2022-02-14 14:12:00 +01:00
ae2a661427
Remove the useless nested structure in StandardComponents::Class 2022-02-14 14:12:00 +01:00
905222f61d
Don't output an extra new line in the stringInterpolation() function 2022-02-14 14:12:00 +01:00
04923f03a5
Revert "Remove a useless #include directive in lex.hpp"
This reverts commit 41e33e30ba5faef9bd841777eae8701718bf8f69.
2022-02-14 14:12:00 +01:00
4f40fdaed7
Add a "=" operator and a default constructor to tok 2022-02-14 14:12:00 +01:00
070189e4a0
Check whether failbit or badbit are set in filefuncs.cpp 2022-02-14 14:12:00 +01:00
afeeaa260f
Actually flush cout before displaying errors 2022-02-14 14:12:00 +01:00
eb709e60b0
Remove the (now useless) parallel parameter in the getFileContent() function from filefuncs.cpp 2022-02-14 14:12:00 +01:00
96dd67b69a
Remove a useless #include directive in lex.hpp 2022-02-14 14:12:00 +01:00
cf4ea8a1f8
Improve the tok constructors 2022-02-14 14:12:00 +01:00
19f76c405c
Remove a useless constructor in lex.hpp 2022-02-14 14:12:00 +01:00
4253d5b922
Remove redundant usage of endl in main.cpp 2022-02-14 14:12:00 +01:00
18daa6495c
Use cerr instead of clog to make sure cout has been flushed before errors get displayed 2022-02-14 14:12:00 +01:00
a078fcd07b
Output errors to clog instead of cout 2022-02-14 14:12:00 +01:00
f90514ba4b
Remove the <optional> include directive in Target.hpp since it is now useless 2022-02-14 14:12:00 +01:00
5580b8f204
Remove redundant optional usage in Target.hpp 2022-02-14 14:12:00 +01:00
1082bcf58f
Allow "_" characters in identifiers 2022-02-14 14:12:00 +01:00
f44cceb11a
Ignore ';' characters 2022-02-14 14:12:00 +01:00
106a2f0be9
Remove a useless semicolon in Target.hpp 2022-02-14 14:12:00 +01:00
cb8e818956
Add shared tasks to Target.hpp 2022-02-14 14:12:00 +01:00
609567cfd1
Add a "unit" alias to main.cpp 2022-02-14 14:12:00 +01:00
b16f974eac
Use the system-wide locale 2022-02-14 14:12:00 +01:00
eb586a2899
Use generic_category::message() instead of strerror() in filefuncs.cpp 2022-02-14 14:12:00 +01:00
e720ff0f2d
Add an error message when an exception is thrown from the getFileContent() function & --parallel is not in use, and support MSVC 2022-02-14 14:12:00 +01:00
d2c0ef185f
Add the C++ standard to the getBuildInfo() function by adding two new macros: "token_expansion" and "make_string" 2022-02-14 14:12:00 +01:00
f266c35954
Use the size_t type instead of "unsigned long" for variables that hold the result of a find() call 2022-02-14 14:12:00 +01:00
158021cf68
Fix the indentation of a line modified by the previous commit 2022-02-14 14:12:00 +01:00
173ed5d6c3
Add a parsingError() function to Parser.hpp 2022-02-14 14:12:00 +01:00
a098973023
Throw an exception when a final variable is being redefined, and use types instead of auto in the ParseTree::findReferenceByName() method and when calling it in Parser.hpp 2022-02-14 14:12:00 +01:00
c9a6a6c918
Remove a useless condition and two unnecessary parentheses in lexer.cpp 2022-02-14 14:12:00 +01:00
3c4586cc70
Add "ASTERISK" and "DIVIDE" token types to lex.hpp, and implement comments 2022-02-14 14:12:00 +01:00
458d272088
Only reassign exit_code when it is meant to be EXIT_FAILURE 2022-02-14 14:12:00 +01:00
30ae9d7369
Remove a useless space in main.cpp 2022-02-14 14:12:00 +01:00
08661d83a3
Add an explicit return type to the nextAre function 2022-02-14 14:12:00 +01:00
70466cdb80
Demangle the name of components when a GNU/Clang compiler is being used 2022-02-14 14:12:00 +01:00
1b9b281dec
Heavily modify Target.hpp, add a pointerAs function, and add an overload to Yerbacon::exit 2022-02-14 14:11:20 +01:00
2cf523bf17
Replace "--newlinesoff" with an assignable argument ("--newlines=on/off") 2021-10-20 17:11:14 +02:00
88d22e6183
Add a "--buildInfo" argument to print the compiler and optimization options used when building 2021-10-20 17:08:41 +02:00
0ce02ea77f
Remove a useless semicolon in ParseComponents.hpp 2021-10-20 13:21:35 +02:00
d9b399881d
Use the derived_from concept in the template of the IS(X) macro 2021-10-20 13:16:54 +02:00
ec2af24be3
Add a [] operator to the ParseTree class 2021-10-20 13:16:40 +02:00