mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 19:21:47 -07:00
Compare commits
7 Commits
v0.12-Alph
...
v0.15-Alph
Author | SHA1 | Date | |
---|---|---|---|
912cc6b538 | |||
3dd5482a46 | |||
632fa10027 | |||
6498b13658 | |||
7f562cd77f | |||
3a0e971ebf | |||
4997cb5878 |
@ -10,6 +10,8 @@ Its not meant to be a black box metaprogramming utility, it should be easy to in
|
||||
|
||||
## Notes
|
||||
|
||||
**On Partial Hiatus: Working on handmade hero for now. Only fixes will be pushed as I come across them until I get what I want done from the series**
|
||||
|
||||
This project is still in development (very much an alpha state), so expect bugs and missing features.
|
||||
See [issues](https://github.com/Ed94/gencpp/issues) for a list of known bugs or todos.
|
||||
|
||||
|
@ -330,6 +330,7 @@
|
||||
<ClCompile Include="project\dependencies\strings.cpp" />
|
||||
<ClCompile Include="project\dependencies\string_ops.cpp" />
|
||||
<ClCompile Include="project\dependencies\timing.cpp" />
|
||||
<ClCompile Include="project\Example.cpp" />
|
||||
<ClCompile Include="project\gen.cpp" />
|
||||
<ClCompile Include="project\gen.dep.cpp" />
|
||||
<ClCompile Include="singleheader\singleheader.cpp" />
|
||||
|
@ -1125,7 +1125,10 @@ String AST::to_string()
|
||||
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export ))
|
||||
result.append( "export " );
|
||||
|
||||
if ( Params )
|
||||
result.append_fmt( "template< %S >\n%S", Params->to_string(), Declaration->to_string() );
|
||||
else
|
||||
result.append_fmt( "template<>\n%S", Declaration->to_string() );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -175,6 +175,11 @@ void define_constants()
|
||||
#endif
|
||||
# undef def_constant_code_type
|
||||
|
||||
|
||||
# define def_constant_spec( Type_, ... ) \
|
||||
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
||||
spec_##Type_.set_global();
|
||||
|
||||
# pragma push_macro("forceinline")
|
||||
# pragma push_macro("global")
|
||||
# pragma push_macro("internal")
|
||||
@ -185,11 +190,6 @@ void define_constants()
|
||||
# undef internal
|
||||
# undef local_persist
|
||||
# undef neverinline
|
||||
|
||||
# define def_constant_spec( Type_, ... ) \
|
||||
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
||||
spec_##Type_.set_global();
|
||||
|
||||
def_constant_spec( const, ESpecifier::Const );
|
||||
def_constant_spec( consteval, ESpecifier::Consteval );
|
||||
def_constant_spec( constexpr, ESpecifier::Constexpr );
|
||||
|
@ -509,6 +509,8 @@ namespace Parser
|
||||
);
|
||||
return { { nullptr }, 0 };
|
||||
}
|
||||
move_forward();
|
||||
content.Length++;
|
||||
|
||||
while ( left && current != '"' && current != '>' )
|
||||
{
|
||||
@ -773,6 +775,18 @@ namespace Parser
|
||||
|
||||
if (left)
|
||||
move_forward();
|
||||
|
||||
if ( current == '=' )
|
||||
{
|
||||
token.Length++;
|
||||
token.IsAssign = true;
|
||||
// token.Flags |= TokFlags::Assignment;
|
||||
// token.Type = TokType::Assign_Multiply;
|
||||
|
||||
if ( left )
|
||||
move_forward();
|
||||
}
|
||||
|
||||
goto FoundToken;
|
||||
}
|
||||
case ';':
|
||||
@ -971,7 +985,14 @@ namespace Parser
|
||||
|
||||
if ( left )
|
||||
{
|
||||
if ( current == '/' )
|
||||
if ( current == '=' )
|
||||
{
|
||||
// token.Type = TokeType::Assign_Divide;
|
||||
move_forward();
|
||||
token.Length++;
|
||||
token.IsAssign = true;
|
||||
}
|
||||
else if ( current == '/' )
|
||||
{
|
||||
token.Type = TokType::Comment;
|
||||
token.Length = 2;
|
||||
@ -2818,7 +2839,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
if ( currtok.Text[1] == '=' )
|
||||
op = Assign_Add;
|
||||
|
||||
if ( currtok.Text[1] == '+' )
|
||||
else if ( currtok.Text[1] == '+' )
|
||||
op = Increment;
|
||||
|
||||
else
|
||||
@ -2838,7 +2859,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
break;
|
||||
}
|
||||
|
||||
if ( currtok.Text[1] == '=' )
|
||||
else if ( currtok.Text[1] == '=' )
|
||||
op = Assign_Subtract;
|
||||
|
||||
else
|
||||
@ -3194,6 +3215,12 @@ CodeParam parse_params( bool use_template_capture )
|
||||
Context.pop();
|
||||
return { nullptr };
|
||||
}
|
||||
else if ( check ( TokType::Operator ) && currtok.Text[0] == '>' )
|
||||
{
|
||||
eat( TokType::Operator );
|
||||
Context.pop();
|
||||
return { nullptr };
|
||||
}
|
||||
|
||||
CodeType type = { nullptr };
|
||||
Code value = { nullptr };
|
||||
@ -5620,7 +5647,7 @@ CodeVar parse_variable()
|
||||
|
||||
// Ignore const specifiers, they're handled by the type
|
||||
if ( spec == ESpecifier::Const )
|
||||
continue;
|
||||
break;
|
||||
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
|
@ -36,12 +36,12 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
|
||||
}
|
||||
|
||||
# define check_param_eq_ret() \
|
||||
if ( ! is_member_symbol && params_code->ValueType != ret_type ) \
|
||||
if ( ! is_member_symbol && ! params_code->ValueType.is_equal( ret_type) ) \
|
||||
{ \
|
||||
log_failure("gen_def_operator: operator%s requires first parameter to equal return type\n" \
|
||||
log_failure("gen::def_operator: operator%s requires first parameter to equal return type\n" \
|
||||
"param types: %s\n" \
|
||||
"return type: %s", \
|
||||
to_str(op), \
|
||||
to_str(op).Ptr, \
|
||||
params_code.debug_str(), \
|
||||
ret_type.debug_str() \
|
||||
); \
|
||||
@ -947,6 +947,7 @@ CodeOperator def_operator( OperatorT op, StrC nspace
|
||||
result = (CodeOperator) make_code();
|
||||
result->Name = get_cached_string( { str_len(name), name } );
|
||||
result->ModuleFlags = mflags;
|
||||
result->Op = op;
|
||||
|
||||
if ( body )
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth : 4
|
||||
|
||||
ContinuationIndentWidth: 0
|
||||
ContinuationIndentWidth: 4
|
||||
|
||||
Cpp11BracedListStyle: false
|
||||
|
||||
|
Reference in New Issue
Block a user