Skip to content

Commit 61e1549

Browse files
committed
add complex types
1 parent db11dcb commit 61e1549

File tree

12 files changed

+368
-287
lines changed

12 files changed

+368
-287
lines changed

jule/jule.tmLanguage.json

Lines changed: 89 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
},
113113
"imaginaryKeywords": {
114114
"name": "storage.type",
115-
"match": "\\b(int|uint|uintptr|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|bool|str|any|byte|rune)\\b"
115+
"match": "\\b(int|uint|uintptr|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|cmplx64|cmplx128|bool|str|any|byte|rune)\\b"
116116
},
117117
"storage": {
118118
"name": "storage.modifier.jule",
@@ -344,6 +344,7 @@
344344
]
345345
},
346346
"numbers": {
347+
"match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])*",
347348
"captures": {
348349
"0": {
349350
"patterns": [
@@ -352,6 +353,7 @@
352353
"end": "(?:\\n|$)",
353354
"patterns": [
354355
{
356+
"match": "(?:(?:(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$)|\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|\\G((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))",
355357
"captures": {
356358
"1": {
357359
"name": "constant.numeric.decimal.jule",
@@ -362,6 +364,45 @@
362364
}
363365
]
364366
},
367+
"2": {
368+
"name": "punctuation.separator.constant.numeric.jule"
369+
},
370+
"3": {
371+
"name": "constant.numeric.decimal.point.jule"
372+
},
373+
"4": {
374+
"name": "constant.numeric.decimal.jule",
375+
"patterns": [
376+
{
377+
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
378+
"name": "punctuation.separator.constant.numeric.jule"
379+
}
380+
]
381+
},
382+
"5": {
383+
"name": "punctuation.separator.constant.numeric.jule"
384+
},
385+
"6": {
386+
"name": "keyword.other.unit.exponent.decimal.jule"
387+
},
388+
"7": {
389+
"name": "keyword.operator.plus.exponent.decimal.jule"
390+
},
391+
"8": {
392+
"name": "keyword.operator.minus.exponent.decimal.jule"
393+
},
394+
"9": {
395+
"name": "constant.numeric.exponent.decimal.jule",
396+
"patterns": [
397+
{
398+
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
399+
"name": "punctuation.separator.constant.numeric.jule"
400+
}
401+
]
402+
},
403+
"10": {
404+
"name": "keyword.other.unit.imaginary.jule"
405+
},
365406
"11": {
366407
"name": "constant.numeric.decimal.jule",
367408
"patterns": [
@@ -392,6 +433,9 @@
392433
}
393434
]
394435
},
436+
"17": {
437+
"name": "keyword.other.unit.imaginary.jule"
438+
},
395439
"18": {
396440
"name": "constant.numeric.decimal.point.jule"
397441
},
@@ -404,9 +448,6 @@
404448
}
405449
]
406450
},
407-
"2": {
408-
"name": "punctuation.separator.constant.numeric.jule"
409-
},
410451
"20": {
411452
"name": "punctuation.separator.constant.numeric.jule"
412453
},
@@ -428,6 +469,9 @@
428469
}
429470
]
430471
},
472+
"25": {
473+
"name": "keyword.other.unit.imaginary.jule"
474+
},
431475
"26": {
432476
"name": "keyword.other.unit.hexadecimal.jule"
433477
},
@@ -446,9 +490,6 @@
446490
"29": {
447491
"name": "constant.numeric.hexadecimal.jule"
448492
},
449-
"3": {
450-
"name": "constant.numeric.decimal.point.jule"
451-
},
452493
"30": {
453494
"name": "constant.numeric.hexadecimal.jule",
454495
"patterns": [
@@ -479,6 +520,9 @@
479520
}
480521
]
481522
},
523+
"36": {
524+
"name": "keyword.other.unit.imaginary.jule"
525+
},
482526
"37": {
483527
"name": "keyword.other.unit.hexadecimal.jule"
484528
},
@@ -494,15 +538,6 @@
494538
"39": {
495539
"name": "punctuation.separator.constant.numeric.jule"
496540
},
497-
"4": {
498-
"name": "constant.numeric.decimal.jule",
499-
"patterns": [
500-
{
501-
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
502-
"name": "punctuation.separator.constant.numeric.jule"
503-
}
504-
]
505-
},
506541
"40": {
507542
"name": "keyword.other.unit.exponent.hexadecimal.jule"
508543
},
@@ -521,6 +556,9 @@
521556
}
522557
]
523558
},
559+
"44": {
560+
"name": "keyword.other.unit.imaginary.jule"
561+
},
524562
"45": {
525563
"name": "keyword.other.unit.hexadecimal.jule"
526564
},
@@ -542,9 +580,6 @@
542580
"49": {
543581
"name": "keyword.other.unit.exponent.hexadecimal.jule"
544582
},
545-
"5": {
546-
"name": "punctuation.separator.constant.numeric.jule"
547-
},
548583
"50": {
549584
"name": "keyword.operator.plus.exponent.hexadecimal.jule"
550585
},
@@ -560,28 +595,13 @@
560595
}
561596
]
562597
},
563-
"6": {
564-
"name": "keyword.other.unit.exponent.decimal.jule"
565-
},
566-
"7": {
567-
"name": "keyword.operator.plus.exponent.decimal.jule"
568-
},
569-
"8": {
570-
"name": "keyword.operator.minus.exponent.decimal.jule"
571-
},
572-
"9": {
573-
"name": "constant.numeric.exponent.decimal.jule",
574-
"patterns": [
575-
{
576-
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
577-
"name": "punctuation.separator.constant.numeric.jule"
578-
}
579-
]
598+
"53": {
599+
"name": "keyword.other.unit.imaginary.jule"
580600
}
581-
},
582-
"match": "(?:(?:(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])(\\d(?:\\d|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=\\d)\\.|\\.(?=\\d)))(\\d(?:\\d|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?:(?<!_)([eE])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$)|\\G(?=[0-9.])(?!0[xXbBoO])(\\d(?:\\d|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([eE])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|\\G((?:(?<=\\d)\\.|\\.(?=\\d)))(\\d(?:\\d|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?:(?<!_)([eE])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?<!_)([pP])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(-?)((?:\\d(?:\\d|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))"
601+
}
583602
},
584603
{
604+
"match": "(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$)|(\\G0[bB])_?([01](?:[01]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))|(\\G0[oO]?)_?((?:[0-7]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))+)(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))",
585605
"captures": {
586606
"1": {
587607
"name": "constant.numeric.decimal.jule",
@@ -592,56 +612,67 @@
592612
}
593613
]
594614
},
595-
"10": {
615+
"2": {
596616
"name": "punctuation.separator.constant.numeric.jule"
597617
},
598-
"12": {
599-
"name": "keyword.other.unit.hexadecimal.jule"
618+
"3": {
619+
"name": "keyword.other.unit.imaginary.jule"
600620
},
601-
"13": {
602-
"name": "constant.numeric.hexadecimal.jule",
621+
"4": {
622+
"name": "keyword.other.unit.binary.jule"
623+
},
624+
"5": {
625+
"name": "constant.numeric.binary.jule",
603626
"patterns": [
604627
{
605628
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
606629
"name": "punctuation.separator.constant.numeric.jule"
607630
}
608631
]
609632
},
610-
"14": {
633+
"6": {
611634
"name": "punctuation.separator.constant.numeric.jule"
612635
},
613-
"2": {
614-
"name": "punctuation.separator.constant.numeric.jule"
636+
"7": {
637+
"name": "keyword.other.unit.imaginary.jule"
615638
},
616-
"4": {
617-
"name": "keyword.other.unit.binary.jule"
639+
"8": {
640+
"name": "keyword.other.unit.octal.jule"
618641
},
619-
"5": {
620-
"name": "constant.numeric.binary.jule",
642+
"9": {
643+
"name": "constant.numeric.octal.jule",
621644
"patterns": [
622645
{
623646
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
624647
"name": "punctuation.separator.constant.numeric.jule"
625648
}
626649
]
627650
},
628-
"6": {
651+
"10": {
629652
"name": "punctuation.separator.constant.numeric.jule"
630653
},
631-
"8": {
632-
"name": "keyword.other.unit.octal.jule"
654+
"11": {
655+
"name": "keyword.other.unit.imaginary.jule"
633656
},
634-
"9": {
635-
"name": "constant.numeric.octal.jule",
657+
"12": {
658+
"name": "keyword.other.unit.hexadecimal.jule"
659+
},
660+
"13": {
661+
"name": "constant.numeric.hexadecimal.jule",
636662
"patterns": [
637663
{
638664
"match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])",
639665
"name": "punctuation.separator.constant.numeric.jule"
640666
}
641667
]
668+
},
669+
"14": {
670+
"name": "punctuation.separator.constant.numeric.jule"
671+
},
672+
"15": {
673+
"name": "keyword.other.unit.imaginary.jule"
642674
}
643-
},
644-
"match": "(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])(\\d(?:\\d|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$)|(\\G0[bB])_?([01](?:[01]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))|(\\G0[oO]?)_?((?:[0-7]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))+)(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))"
675+
}
645676
},
646677
{
647678
"match": "(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])+",
@@ -651,8 +682,7 @@
651682
}
652683
]
653684
}
654-
},
655-
"match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])*"
685+
}
656686
},
657687
"operators": {
658688
"patterns": [

src/compiler/compiler-optimizations.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,6 @@ Enables special optimizations for the `std/strings` package.
192192

193193
- Removes exceptional handling cost if possible of the `Write`, `WriteByte`, `WriteRune`, and `WRiteStr` methods of the `Builder` struct.
194194

195-
---
196-
197-
`--opt-math-cmplx`\
198-
Enables special optimizations for the `std/math/cmplx` package.
199-
200-
- Makes computations mutable instead creating new complex number and assigning to existing complex number.
201-
202195
## Optimization Levels
203196

204197
It can be a hassle to pass all flags one by one to send most optimizations to the compiler.
@@ -214,7 +207,7 @@ The optimization levels are as follows:
214207

215208
- `L0`: The default optimization level: no special optimizations.
216209
- `L1`: passes all `L0` flags with `--opt-zcopy`, `--opt-zappend`, `--opt-copy`, `--opt-deadcode`, `--opt-append`, `--opt-math`, `--opt-access`, `--opt-inline`, `--opt-ptr`, `--opt-cond`, `--opt-str`, `--opt-slice`, `--opt-assign`, `--opt-iter`, `--opt-dynamic`, `--opt-array`, `--opt-len`
217-
- `L2`: passes all `L1` flags with `--opt-std-strings`, `--opt-std-math-cmplx`
210+
- `L2`: passes all `L1` flags with `--opt-std-strings`
218211

219212
## Production Compilation
220213

0 commit comments

Comments
 (0)