mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-09 22:38:06 -05:00
Adjust further code formatting
This commit is contained in:
@ -15,7 +15,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -31,7 +33,9 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueNoScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({new SequencePass()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequencePass(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_FIRST_TOKEN),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -44,7 +46,11 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("stateMap").Capture(CAPTURE_START), create.String().Capture(CAPTURE_STATE_MAP_NAME), create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Keyword("stateMap").Capture(CAPTURE_START),
|
||||
create.String().Capture(CAPTURE_STATE_MAP_NAME),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -76,21 +82,25 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create
|
||||
.Or({
|
||||
create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER),
|
||||
create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER),
|
||||
})
|
||||
.Capture(CAPTURE_START),
|
||||
create.Or({create.And({
|
||||
create.Integer().Capture(CAPTURE_VERSION_MAJOR),
|
||||
create.Char('.'),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MINOR),
|
||||
}),
|
||||
create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it
|
||||
create.String().Capture(CAPTURE_VERSION)}),
|
||||
create.String().Capture(CAPTURE_SHADER_NAME),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create
|
||||
.Or({
|
||||
create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER),
|
||||
create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER),
|
||||
})
|
||||
.Capture(CAPTURE_START),
|
||||
create.Or({
|
||||
create.And({
|
||||
create.Integer().Capture(CAPTURE_VERSION_MAJOR),
|
||||
create.Char('.'),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MINOR),
|
||||
}),
|
||||
create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it
|
||||
create.String().Capture(CAPTURE_VERSION),
|
||||
}),
|
||||
create.String().Capture(CAPTURE_SHADER_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -137,19 +147,29 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), create.Char(']')})),
|
||||
AddMatchers({
|
||||
create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
|
||||
create.Char('='),
|
||||
create.Char('='),
|
||||
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), create.Char(']')})),
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
|
||||
create.Char(';')});
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
static std::string CreateRoutingString(SequenceResult<SimpleParserValue>& result, const int nameCapture, const int indexCapture)
|
||||
@ -184,8 +204,12 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniquePassScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests(
|
||||
{new SequenceEndPass(), new SequenceStateMap(), new SequenceShader(), new SequenceVertexStreamRouting()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndPass(),
|
||||
new SequenceStateMap(),
|
||||
new SequenceShader(),
|
||||
new SequenceVertexStreamRouting(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}')});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -44,16 +46,33 @@ namespace techset
|
||||
|
||||
static std::unique_ptr<matcher_t> CodeMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({create.Or({create.Keyword("constant").Tag(TAG_CONSTANT), create.Keyword("sampler").Tag(TAG_SAMPLER)}),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
create.OptionalLoop(create.And({create.Char('.'), create.Identifier().Capture(CAPTURE_CODE_ACCESSOR)})),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_CODE_INDEX), create.Char(']')}))});
|
||||
return create.And({
|
||||
create.Or({
|
||||
create.Keyword("constant").Tag(TAG_CONSTANT),
|
||||
create.Keyword("sampler").Tag(TAG_SAMPLER),
|
||||
}),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
})),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_CODE_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> LiteralValueMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.Or({create.FloatingPoint(), create.Integer()}).Capture(CAPTURE_LITERAL_VALUE);
|
||||
return create
|
||||
.Or({
|
||||
create.FloatingPoint(),
|
||||
create.Integer(),
|
||||
})
|
||||
.Capture(CAPTURE_LITERAL_VALUE);
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> LiteralMatchers(const SimpleMatcherFactory& create)
|
||||
@ -77,11 +96,18 @@ namespace techset
|
||||
static std::unique_ptr<matcher_t> MaterialMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create
|
||||
.And({create.Keyword("material"),
|
||||
create.Char('.'),
|
||||
.And({
|
||||
create.Keyword("material"),
|
||||
create.Char('.'),
|
||||
|
||||
create.Or({create.And({create.Char('#'), create.Integer().Capture(CAPTURE_MATERIAL_HASH)}),
|
||||
create.Identifier().Capture(CAPTURE_MATERIAL_NAME)})})
|
||||
create.Or({
|
||||
create.And({
|
||||
create.Char('#'),
|
||||
create.Integer().Capture(CAPTURE_MATERIAL_HASH),
|
||||
}),
|
||||
create.Identifier().Capture(CAPTURE_MATERIAL_NAME),
|
||||
}),
|
||||
})
|
||||
.Tag(TAG_MATERIAL);
|
||||
}
|
||||
|
||||
@ -90,12 +116,22 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(),
|
||||
create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_SHADER_INDEX), create.Char(']')})),
|
||||
create.Char('='),
|
||||
create.Or({CodeMatchers(create), LiteralMatchers(create), MaterialMatchers(create)}),
|
||||
create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(),
|
||||
create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_SHADER_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
create.Char('='),
|
||||
create.Or({
|
||||
CodeMatchers(create),
|
||||
LiteralMatchers(create),
|
||||
MaterialMatchers(create),
|
||||
}),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
static void ProcessCodeArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg, const bool isSampler)
|
||||
@ -197,7 +233,10 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueShaderScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({new SequenceEndShader(), new SequenceShaderArgument()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndShader(),
|
||||
new SequenceShaderArgument(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.String().Capture(CAPTURE_TYPE_NAME), create.Char(':')});
|
||||
AddMatchers({
|
||||
create.String().Capture(CAPTURE_TYPE_NAME),
|
||||
create.Char(':'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -40,7 +43,15 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Or({create.Identifier(), create.String()}).Capture(CAPTURE_NAME), create.Char(';')});
|
||||
AddMatchers({
|
||||
create
|
||||
.Or({
|
||||
create.Identifier(),
|
||||
create.String(),
|
||||
})
|
||||
.Capture(CAPTURE_NAME),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -66,8 +77,13 @@ TechsetParser::TechsetParser(SimpleLexer* lexer, const char** validTechniqueType
|
||||
|
||||
const std::vector<TechsetParser::sequence_t*>& TechsetParser::GetTestsForState()
|
||||
{
|
||||
static std::vector<sequence_t*> allTests({new SequenceTechniqueTypeName(), new SequenceTechniqueName()});
|
||||
static std::vector<sequence_t*> techniqueTypeNameOnlyTests({new SequenceTechniqueTypeName()});
|
||||
static std::vector<sequence_t*> allTests({
|
||||
new SequenceTechniqueTypeName(),
|
||||
new SequenceTechniqueName(),
|
||||
});
|
||||
static std::vector<sequence_t*> techniqueTypeNameOnlyTests({
|
||||
new SequenceTechniqueTypeName(),
|
||||
});
|
||||
|
||||
return m_state->m_current_technique_types.empty() ? techniqueTypeNameOnlyTests : allTests;
|
||||
}
|
||||
|
Reference in New Issue
Block a user