inweb-bootstrap/Languages/InC.ildf

97 lines
2.4 KiB
Text
Raw Permalink Normal View History

Name: "InC"
Details: "The Inform-tools extension to the C programming language"
Extension: ".c"
2020-04-04 12:07:08 +00:00
Supports Namespaces: true
Multiline Comment Open: "/*"
Multiline Comment Close: "*/"
Line Comment: "//"
2020-04-06 11:26:10 +00:00
String Literal: "\""
String Literal Escape: "\\"
Character Literal: "'"
Character Literal Escape: "\\"
2020-04-04 12:07:08 +00:00
C-Like: true
2020-04-05 17:37:43 +00:00
# C does in fact support octal literals, marking them as starting with an
# unnecessary initial zero. This is practically obsolete now, and in any case
# makes no difference to syntax-colouring. Binary literals were in theory
# rejected by the C standards body as useless, but are so useful that gcc
# and clang support them anyway.
Hexadecimal Literal Prefix: "0x"
Binary Literal Prefix: "0b"
Negative Literal Prefix: "-"
2020-04-04 13:15:50 +00:00
# The "shebang" routine for a language is called to add anything it wants to
# at the very top of the tangled code. (For a scripting language such as
# Perl or Python, that might be a shebang: "hence the name.)"
2020-04-04 13:15:50 +00:00
# But we will use it to defime the constant PLATFORM_POSIX everywhere except
# Windows. This needs to happen right at the top, because the "very early
# code" in a tangle may contain material conditional on whether it is defined.
Shebang: "#ifndef PLATFORM_WINDOWS\n#define PLATFORM_POSIX\n#endif\n"
Before Named Paragraph Expansion: "\n{\n"
After Named Paragraph Expansion: "}\n"
Start Ifdef: "#ifdef %S\n"
End Ifdef: "#endif /* %S */\n"
Start Ifndef: "#ifndef %S\n"
End Ifndef: "#endif /* %S */\n"
2020-04-06 11:26:10 +00:00
Line Marker: "#line %d \"%f\"\n"
Start Definition: "#define %S\s"
Prolong Definition: "\\\n\s\s\s\s"
End Definition: "\n"
2020-04-04 19:46:43 +00:00
# FILE gets in even though it's not technically reserved but only a type
# name, defined in the standard C library.
keyword FILE
2020-04-04 19:46:43 +00:00
keyword auto
keyword break
keyword case
keyword char
keyword const
keyword continue
keyword default
keyword do
keyword double
keyword else
keyword enum
keyword extern
keyword float
keyword for
keyword goto
keyword if
keyword int
keyword long
keyword register
keyword return
keyword short
keyword signed
keyword sizeof
keyword static
keyword struct
keyword switch
keyword typedef
keyword union
keyword unsigned
keyword void
keyword volatile
keyword while
2020-04-04 19:46:43 +00:00
colouring {
runs of unquoted {
runs of !identifier {
2020-04-06 11:26:10 +00:00
keyword of !reserved => !reserved
keyword of !function => !function
keyword of !constant => !constant
keyword of !element => {
2020-04-04 19:46:43 +00:00
optionally spaced prefix . => !element
optionally spaced prefix -> => !element
}
}
matches of /<\S+>/ {
=> !function
}
2020-04-04 19:46:43 +00:00
}
}