ifc-language-server/syntaxes/ifc.tmLanguage.json
Ryan Schultz 95786a26ec feat: Add syntax highlighting for IFC files
Added TextMate grammar for IFC syntax highlighting:

Syntax Elements:
- Entity IDs (#123) - highlighted as constants
- Entity types (IFCWALL, IFCPROJECT) - highlighted as type names
- Entity references (#N) - highlighted as variables
- Strings ('text') - string highlighting with escape sequences
- Numbers (integers, floats, scientific notation) - numeric constants
- Keywords (HEADER, DATA, ENDSEC, ISO-10303-21) - control keywords
- Section headers (FILE_DESCRIPTION, FILE_NAME, FILE_SCHEMA) - section keywords
- Special values ($, *, .T., .F., .U.) - language constants
- Comments (/* ... */) - comment highlighting

Created syntaxes/ifc.tmLanguage.json with complete IFC grammar.
Updated package.json to register grammar with language.

IFC files now have proper syntax coloring based on editor theme.
2025-12-07 12:26:29 -06:00

112 lines
2.9 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "IFC",
"scopeName": "source.ifc",
"patterns": [
{
"include": "#header"
},
{
"include": "#section"
},
{
"include": "#entity"
},
{
"include": "#entity-reference"
},
{
"include": "#string"
},
{
"include": "#number"
},
{
"include": "#keyword"
},
{
"include": "#comment"
}
],
"repository": {
"header": {
"patterns": [
{
"name": "keyword.control.ifc",
"match": "^(ISO-10303-21|HEADER|ENDSEC|DATA|END-ISO-10303-21);"
}
]
},
"section": {
"patterns": [
{
"name": "keyword.control.section.ifc",
"match": "^(FILE_DESCRIPTION|FILE_NAME|FILE_SCHEMA)\\b"
}
]
},
"entity": {
"patterns": [
{
"name": "meta.entity.ifc",
"match": "^(#\\d+)\\s*=\\s*(\\w+)",
"captures": {
"1": {
"name": "constant.numeric.entity-id.ifc"
},
"2": {
"name": "entity.name.type.ifc"
}
}
}
]
},
"entity-reference": {
"patterns": [
{
"name": "variable.other.entity-reference.ifc",
"match": "#\\d+\\b"
}
]
},
"string": {
"patterns": [
{
"name": "string.quoted.single.ifc",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.ifc",
"match": "\\\\."
}
]
}
]
},
"number": {
"patterns": [
{
"name": "constant.numeric.ifc",
"match": "\\b\\d+\\.?\\d*([eE][+-]?\\d+)?\\b"
}
]
},
"keyword": {
"patterns": [
{
"name": "constant.language.ifc",
"match": "\\$|\\*|\\.(T|F|U|UNKNOWN|TRUE|FALSE)\\."
}
]
},
"comment": {
"patterns": [
{
"name": "comment.line.ifc",
"match": "/\\*.*?\\*/"
}
]
}
}
}