add example custom syntax stuff to the example site
This commit is contained in:
parent
1d83b95211
commit
73e400db1a
|
@ -40,6 +40,14 @@ posts:
|
||||||
- donuts
|
- donuts
|
||||||
- coffee
|
- coffee
|
||||||
|
|
||||||
|
- file_path: 2023-06-30-qbasic-is-fun.md
|
||||||
|
title: QBasic Is Fun
|
||||||
|
date: 2023-06-30
|
||||||
|
slug: qbasic-is-fun
|
||||||
|
tags:
|
||||||
|
- qbasic
|
||||||
|
- testing
|
||||||
|
|
||||||
rss:
|
rss:
|
||||||
title: My Site
|
title: My Site
|
||||||
description: This is my site. There are others like it, but this one is mine.
|
description: This is my site. There are others like it, but this one is mine.
|
||||||
|
|
17
example-site/posts/2023-06-30-qbasic-is-fun.md
Normal file
17
example-site/posts/2023-06-30-qbasic-is-fun.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
QBasic is fun. And we can syntax highlight the below code here via loading custom syntax definitions from a path
|
||||||
|
specified in the `server.yml` file. Unfortunately, this only supports loading from `.sublime-text` files, **not**
|
||||||
|
from `.tmLanguage` files.
|
||||||
|
|
||||||
|
```bas
|
||||||
|
DEFINT A-Z
|
||||||
|
SCREEN 13
|
||||||
|
DEF SEG = &HA000
|
||||||
|
|
||||||
|
CLS
|
||||||
|
DO UNTIL INKEY$ = CHR$(27)
|
||||||
|
x = RND * 320
|
||||||
|
y = RND * 200
|
||||||
|
clr = RND * 256
|
||||||
|
POKE (y * 320) + x, clr
|
||||||
|
LOOP
|
||||||
|
```
|
|
@ -4,3 +4,4 @@ static_files_path: static
|
||||||
templates_path: templates
|
templates_path: templates
|
||||||
pages_path: pages
|
pages_path: pages
|
||||||
posts_path: posts
|
posts_path: posts
|
||||||
|
syntaxes_path: syntaxes
|
72
example-site/syntaxes/QBasic.sublime-syntax
Normal file
72
example-site/syntaxes/QBasic.sublime-syntax
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: QBasic
|
||||||
|
file_extensions:
|
||||||
|
- bas
|
||||||
|
- qb
|
||||||
|
scope: source.qbasic
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: (').*
|
||||||
|
comment: Comment
|
||||||
|
scope: comment.line.qbasic
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.qbasic
|
||||||
|
- match: "[,:;]"
|
||||||
|
comment: Delimiter
|
||||||
|
scope: meta.delimiter.object.qbasic
|
||||||
|
- match: \b((END )?IF|(END )?SELECT|(RESUME )?NEXT|CASE|CLOSE|DO|ELSE|FOR|GOSUB|GOTO|LOOP|ON|OPEN|RETURN|THEN|TO|UNTIL|WHILE)\b
|
||||||
|
comment: Keyword
|
||||||
|
scope: keyword.control.qbasic
|
||||||
|
- match: (\+|=|<|>|<>|AND|OR)
|
||||||
|
comment: Operator
|
||||||
|
scope: keyword.operator.qbasic
|
||||||
|
- match: \b(CHR\$|CLS|COLOR|DATA|INPUT|INT|KEY|LEN|LINE|LOCATE|PALETTE|PLAY|PRINT|PSET|PUT|REDIM|RND|SCREEN|TAB|VIEW)\b
|
||||||
|
comment: Function
|
||||||
|
scope: support.function.qbasic
|
||||||
|
- match: \b(\d(\.\d)?)+
|
||||||
|
comment: Numeric
|
||||||
|
scope: constant.numeric.qbasic
|
||||||
|
- match: \b\w+\$
|
||||||
|
comment: Global
|
||||||
|
scope: constant.global.qbasic
|
||||||
|
- match: '^(\w+):'
|
||||||
|
comment: SUB
|
||||||
|
scope: meta.function.qbasic
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.qbasic
|
||||||
|
- match: '[\(\)]'
|
||||||
|
comment: Brace, round
|
||||||
|
scope: meta.brace.round.qbasic
|
||||||
|
- match: '[\{\}]'
|
||||||
|
comment: Brace, curly
|
||||||
|
scope: meta.brace.curly.qbasic
|
||||||
|
- match: (\w+\()
|
||||||
|
comment: Array
|
||||||
|
captures:
|
||||||
|
1: constant.array.qbasic
|
||||||
|
push:
|
||||||
|
- meta_scope: other.array.qbasic
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: constant.array.qbasic
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: (")
|
||||||
|
comment: String, double-quoted
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.qbasic
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.qbasic
|
||||||
|
- match: (")
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.qbasic
|
||||||
|
pop: true
|
||||||
|
- match: (\\")
|
||||||
|
comment: Escaped double-quote inside double-quoted string
|
||||||
|
scope: constant.character.escape.qbasic
|
||||||
|
- match: (')
|
||||||
|
comment: Single quote inside double-quoted string
|
||||||
|
scope: other.qbasic
|
||||||
|
- include: main
|
Loading…
Reference in a new issue