ludus::tooling::shader_language¶
Ludus Wiki · API overview · Browse API
Namespace
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
Related declarations¶
- ludus::tooling::shader_language::ConfigurationValue
- ludus::tooling::shader_language::Diagnostic
- ludus::tooling::shader_language::PreprocessRequest
- ludus::tooling::shader_language::PreprocessResult
- ludus::tooling::shader_language::SourceLocation
- ludus::tooling::shader_language::Token
Enumerations¶
DiagnosticCode¶
enum class DiagnosticCode : foundation::uint16
LUSL followed by four digits (LUSL0201). Related types: foundation::uint16
LogicalNot¶
LogicalNot = 1
! does not exist in LUSL; compare with == false, or with == 0 in #if. InvalidRequest¶
InvalidRequest = 2
InvalidUtf8¶
InvalidUtf8 = 101
InvalidCharacter¶
InvalidCharacter = 102
@, $, a backtick or non-ASCII text outside a comment or string. UnterminatedComment¶
UnterminatedComment = 103
/* comment has no closing */. UnterminatedString¶
UnterminatedString = 104
InvalidEscape¶
InvalidEscape = 105
\\, \", \n, \r or \t. CharacterLiteral¶
CharacterLiteral = 106
'a'; LUSL has no character type. FileTokenLimit¶
FileTokenLimit = 107
UnknownDirective¶
UnknownDirective = 201
MalformedDirective¶
MalformedDirective = 202
IncludeNotFound¶
IncludeNotFound = 203
#include path. IncludeNotHeader¶
IncludeNotHeader = 204
#include names a file that is not a .luslh header. InvalidIncludePath¶
InvalidIncludePath = 205
#include path is absolute, contains a backslash or empty component, or leaves the snapshot root. RecursiveInclude¶
RecursiveInclude = 206
#pragma once. IncludeDepthLimit¶
IncludeDepthLimit = 207
#include nesting exceeds MAX_INCLUDE_DEPTH. MacroRedefined¶
MacroRedefined = 208
ConfigurationModified¶
ConfigurationModified = 209
#define or #undef. ReservedMacroName¶
ReservedMacroName = 210
defined cannot be a macro name. VariadicMacro¶
VariadicMacro = 211
...; LUSL macros are not variadic. DuplicateMacroParameter¶
DuplicateMacroParameter = 212
StringifyNotParameter¶
StringifyNotParameter = 213
# in a function-like macro body is not followed by a parameter. PasteAtEdge¶
PasteAtEdge = 214
## begins or ends a macro body. InvalidPaste¶
InvalidPaste = 215
## joins two tokens whose combined spelling is not exactly one token. MacroArgumentCount¶
MacroArgumentCount = 216
UnterminatedMacroInvocation¶
UnterminatedMacroInvocation = 217
). DirectiveInMacroArguments¶
DirectiveInMacroArguments = 218
UndefinedIdentifierInCondition¶
UndefinedIdentifierInCondition = 219
#if or #elif expression after macro expansion. C treats it as zero; LUSL rejects it so misspelled names are caught. UnknownMacroName¶
UnknownMacroName = 220
defined, #ifdef or #ifndef tests a name that is neither a configuration value nor a macro defined or undefined earlier in the translation unit. InvalidCondition¶
InvalidCondition = 221
#if or #elif expression is not a valid integer constant expression. ConditionDivisionByZero¶
ConditionDivisionByZero = 222
#if or #elif operand divides by zero. ConditionOverflow¶
ConditionOverflow = 223
#if or #elif operation overflows int64 or shifts out of range. UnterminatedConditional¶
UnterminatedConditional = 224
#if group has no #endif before the end of the file that opened it. UnmatchedConditional¶
UnmatchedConditional = 225
#elif, #else or #endif has no matching #if, or follows #else. ErrorDirective¶
ErrorDirective = 226
#error directive was reached; its text is the message. UnknownPragma¶
UnknownPragma = 227
#pragma other than #pragma once. LineDirective¶
LineDirective = 228
#line is reserved for generated code. ConditionalDepthLimit¶
ConditionalDepthLimit = 229
#if nesting exceeds MAX_CONDITIONAL_DEPTH, or expression nesting exceeds MAX_CONDITION_NESTING. MacroExpansionLimit¶
MacroExpansionLimit = 230
OutputTokenLimit¶
OutputTokenLimit = 231
MacroLimit¶
MacroLimit = 232
DefinedFromExpansion¶
DefinedFromExpansion = 233
defined appears in an #if expression as a result of macro expansion. Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
Severity¶
enum class Severity : foundation::uint8
Related types: foundation::uint8
Error¶
Error
Warning¶
Warning
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
Status¶
enum class Status : foundation::uint8
Related types: foundation::uint8
Ready¶
Ready
Failed¶
Failed
InvalidRequest¶
InvalidRequest
OutOfMemory¶
OutOfMemory
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/preprocessor.hpp
TokenKind¶
enum class TokenKind : foundation::uint8
Related types: foundation::uint8
Identifier¶
Identifier
[A-Za-z_][A-Za-z0-9_]*. Keywords are identifiers until the parser classifies them. Number¶
Number
. and a digit, followed by digits, letters, _, . and exponent signs (e+, E-, p+, P-). Its value is checked by later stages. String¶
String
Punctuator¶
Punctuator
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/token.hpp
Punctuator¶
enum class Punctuator : foundation::uint8
Related types: foundation::uint8
None¶
None
LeftBrace¶
LeftBrace
{ RightBrace¶
RightBrace
} LeftBracket¶
LeftBracket
[ RightBracket¶
RightBracket
] LeftParenthesis¶
LeftParenthesis
( RightParenthesis¶
RightParenthesis
) Semicolon¶
Semicolon
; Comma¶
Comma
, Period¶
Period
. Ellipsis¶
Ellipsis
... Colon¶
Colon
: ColonColon¶
ColonColon
:: Question¶
Question
? Equal¶
Equal
= EqualEqual¶
EqualEqual
== Exclamation¶
Exclamation
!, which only exists to report DiagnosticCode::LogicalNot ExclamationEqual¶
ExclamationEqual
!= Less¶
Less
< LessEqual¶
LessEqual
<= Greater¶
Greater
> GreaterEqual¶
GreaterEqual
>= Plus¶
Plus
+ Minus¶
Minus
- Star¶
Star
* Slash¶
Slash
/ Percent¶
Percent
% Ampersand¶
Ampersand
& Pipe¶
Pipe
| Caret¶
Caret
^ Tilde¶
Tilde
~ LessLess¶
LessLess
<< GreaterGreater¶
GreaterGreater
>> AmpersandAmpersand¶
AmpersandAmpersand
&& PipePipe¶
PipePipe
|| PlusEqual¶
PlusEqual
+= MinusEqual¶
MinusEqual
-= StarEqual¶
StarEqual
*= SlashEqual¶
SlashEqual
/= PercentEqual¶
PercentEqual
%= AmpersandEqual¶
AmpersandEqual
&= PipeEqual¶
PipeEqual
|= CaretEqual¶
CaretEqual
^= LessLessEqual¶
LessLessEqual
<<= GreaterGreaterEqual¶
GreaterGreaterEqual
>>= PlusPlus¶
PlusPlus
++ MinusMinus¶
MinusMinus
-- Arrow¶
Arrow
-> Hash¶
Hash
# HashHash¶
HashHash
## Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/token.hpp
Aliases¶
DiagnosticMessage¶
using ludus::tooling::shader_language::DiagnosticMessage = foundation::StaticString<MAX_DIAGNOSTIC_MESSAGE_BYTES>
Related types: foundation::StaticString · MAX_DIAGNOSTIC_MESSAGE_BYTES
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
Constants and variables¶
CONFIGURATION_SOURCE¶
constexpr foundation::uint16 ludus::tooling::shader_language::CONFIGURATION_SOURCE = 0xfffe
Related types: foundation::uint16
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
NO_SOURCE¶
constexpr foundation::uint16 ludus::tooling::shader_language::NO_SOURCE = 0xffff
Related types: foundation::uint16
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
MAX_FILE_TOKENS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_FILE_TOKENS = foundation::usize{1} << 20
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_OUTPUT_TOKENS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_OUTPUT_TOKENS = foundation::usize{1} << 20
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_INCLUDE_DEPTH¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_INCLUDE_DEPTH = 32
#include nesting; the root file is depth one. Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_CONDITIONAL_DEPTH¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_CONDITIONAL_DEPTH = 64
#if groups in one translation unit. Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_CONDITION_NESTING¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_CONDITION_NESTING = 64
#if or #elif expression. Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_MACROS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_MACROS = 4096
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_MACRO_PARAMETERS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_MACRO_PARAMETERS = 32
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_MACRO_EXPANSION_DEPTH¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_MACRO_EXPANSION_DEPTH = 32
F(G(H(x))). Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_MACRO_EXPANSIONS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_MACRO_EXPANSIONS = foundation::usize{1} << 18
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_SYNTHESIZED_BYTES¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_SYNTHESIZED_BYTES = foundation::usize{1} << 20
#, ## and configuration values. Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_CONFIGURATION_VALUES¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_CONFIGURATION_VALUES = 256
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_CONFIGURATION_TEXT_BYTES¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_CONFIGURATION_TEXT_BYTES = 1024
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_DIAGNOSTICS¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_DIAGNOSTICS = 256
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
MAX_DIAGNOSTIC_MESSAGE_BYTES¶
constexpr foundation::usize ludus::tooling::shader_language::MAX_DIAGNOSTIC_MESSAGE_BYTES = 256
Related types: foundation::usize
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/limits.hpp
NO_EXPANSION¶
constexpr foundation::uint32 ludus::tooling::shader_language::NO_EXPANSION = 0xffffffffU
Related types: foundation::uint32
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/token.hpp
Functions¶
GetDiagnosticCodeName¶
std::string_view ludus::tooling::shader_language::GetDiagnosticCodeName(DiagnosticCode code) noexcept
unknown-directive. Returns
Related types: DiagnosticCode
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/diagnostic.hpp
Preprocess¶
Status ludus::tooling::shader_language::Preprocess(const PreprocessRequest &request, PreprocessResult &outResult) noexcept
#include "path" of .luslh headers, #pragma once, object-like and function-like #define with # and ##, #undef, #if, #ifdef, #ifndef, #elif, #else, #endif, defined and #error. It departs from C where docs/modules/tooling/shader-language.md says so: an undefined identifier in a condition and an unknown name tested by defined are errors, unary ! does not exist, macros are not variadic and #line is reserved.| Parameter | Description |
|---|---|
request |
Snapshot, root file and configuration values; borrowed for the call.
|
outResult |
Receives the result; any previous contents are replaced.
|
Returns
outResult.Outcome. Related types: Status · PreprocessRequest · PreprocessResult
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/preprocessor.hpp
GetTokenSpelling¶
std::string_view ludus::tooling::shader_language::GetTokenSpelling(const PreprocessRequest &request, const PreprocessResult &result, const Token &token) noexcept
| Parameter | Description |
|---|---|
request |
The request that produced
result; its file texts must still be alive. |
result |
The result that holds
token. |
token |
A token of
result. |
Returns
Related types: PreprocessRequest · PreprocessResult · Token
Declared in modules/tooling/shader_language/include/ludus/tooling/shader_language/preprocessor.hpp