Skip to content

Commit b2eee85

Browse files
committed
Add support for angle quotes
1 parent cd908e1 commit b2eee85

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

public/themes/oneDarkPro.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
color: #98c379;
6868
}
6969

70+
.aurora-quote.angle {
71+
color: #98c379;
72+
}
73+
7074
/* Format specifier color */
7175
.aurora-format_specifier {
7276
color: #d19a66;

src/tokenizer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ function headerFileLiteral(char: string, code: string, curr: number, tokens: Tok
282282
tokens.push({ type: 'whitespace', value });
283283

284284
value = '';
285-
tokens.push({ type: 'quote double', value: '"' });
285+
// tokens.push({ type: 'quote double', value: '"' });
286286

287287
if (char === '"') {
288+
tokens.push({ type: 'quote double', value: '"' });
288289
char = code[++curr];
289290
while (char !== '"') {
290291
if (curr >= code.length) {
@@ -302,7 +303,7 @@ function headerFileLiteral(char: string, code: string, curr: number, tokens: Tok
302303
}
303304

304305
if (char === '<') {
305-
// headerFile = char == '<' ? '&lt' : char;
306+
tokens.push({ type: 'quote angle', value: '<' });
306307
char = code[++curr];
307308
while (char !== '>') {
308309
if (curr >= code.length) {

test/console_highlighter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const colorMap = {
4343
quote: (s: string) => pc.bold(pc.green(s)),
4444
'quote double': (s: string) => pc.bold(pc.green(s)),
4545
'quote single': (s: string) => pc.bold(pc.green(s)),
46+
'quote angle': (s: string) => pc.bold(pc.green(s)),
4647
format_specifier: (s: string) => pc.yellow(s),
4748
number: (s: string) => pc.yellow(s),
4849
bin_prefix: (s: string) => pc.bold(pc.red(s)),

test/index.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import fs from 'fs';
22
import { test } from 'vitest';
33
import { Node } from '../src/node_generator';
44
import tokenizer from '../src/tokenizer';
5+
import consoleHighlighter from './console_highlighter';
56

67
test('tokenize', () => {
7-
const cFile = './test/SpeedTest.c';
8+
const cFile = './test/test.c';
89
const cCode = fs.readFileSync(cFile, 'utf-8').toString();
910
const now = performance.now();
1011
const tokens = tokenizer(cCode);
1112
// const nodes = nodeGenerator(tokens);
12-
// const highlighter = consoleHighlighter(tokens);
13-
// console.log(highlighter);
13+
const highlighter = consoleHighlighter(tokens);
14+
console.log(highlighter);
1415
console.log(performance.now() - now);
1516
});
1617

0 commit comments

Comments
 (0)