Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added syntax highlighting for numbers, identifiers and template literals #1047

Merged
merged 3 commits into from
Jan 8, 2021

Conversation

Razican
Copy link
Member

@Razican Razican commented Jan 7, 2021

This Pull Request adds syntax highlighting in our REPL (boa CLI console) for numbers (also binary and hexadecimal), for identifiers, and for template literals.

It should make it easier to see different parts of the code. Here you have a small sneak-peek on how it looks in a dark-themed shell:
Screenshot from 2021-01-07 17-19-06

Note that the template literals fail until we merge #997.

@Razican Razican added enhancement New feature or request cli Issues and PRs related to the Boa command line interface. labels Jan 7, 2021
@Razican Razican added this to the v0.11.0 milestone Jan 7, 2021
@github-actions
Copy link

github-actions bot commented Jan 7, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,493 78,493 0
Passed 24,444 24,444 0
Ignored 15,585 15,585 0
Failed 38,464 38,464 0
Panics 90 90 0
Conformance 31.14 31.14 0.00%

@codecov
Copy link

codecov bot commented Jan 7, 2021

Codecov Report

Merging #1047 (a9dc69d) into master (1a7e832) will decrease coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1047      +/-   ##
==========================================
- Coverage   58.56%   58.26%   -0.30%     
==========================================
  Files         172      172              
  Lines       11920    11981      +61     
==========================================
  Hits         6981     6981              
- Misses       4939     5000      +61     
Impacted Files Coverage Δ
boa_cli/src/helper.rs 0.00% <ø> (ø)
boa/src/vm/mod.rs 0.00% <0.00%> (ø)
boa/src/vm/compilation.rs 0.00% <0.00%> (ø)
boa/src/vm/instructions.rs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a7e832...a9dc69d. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 7, 2021

Benchmark for ccb3242

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 301.9±0.17ns 301.6±0.24ns +0.10%
Arithmetic operations (Full) 197.8±0.39µs 197.3±0.45µs +0.25%
Array access (Execution) 5.2±0.01µs 5.3±0.02µs -1.89%
Array access (Full) 217.6±0.28µs 216.9±0.25µs +0.32%
Array creation (Execution) 2.6±0.01ms 2.6±0.00ms 0.00%
Array creation (Full) 2.8±0.03ms 2.8±0.00ms 0.00%
Array pop (Execution) 820.9±2.48µs 820.5±2.21µs +0.05%
Array pop (Full) 1206.4±1.28µs 1204.1±1.54µs +0.19%
Boolean Object Access (Execution) 4.2±0.01µs 4.2±0.00µs 0.00%
Boolean Object Access (Full) 208.3±0.26µs 208.1±2.04µs +0.10%
Clean js (Execution) 580.0±4.02µs 575.7±3.29µs +0.75%
Clean js (Full) 828.0±4.63µs 822.7±4.49µs +0.64%
Clean js (Parser) 30.4±0.09µs 30.3±0.02µs +0.33%
Create Realm 407.7±0.23ns 416.2±0.39ns -2.04%
Dynamic Object Property Access (Execution) 4.3±0.01µs 4.3±0.01µs 0.00%
Dynamic Object Property Access (Full) 211.3±0.26µs 213.1±0.31µs -0.84%
Expression (Parser) 5.7±0.00µs 5.7±0.01µs 0.00%
Fibonacci (Execution) 731.1±0.69µs 717.8±1.15µs +1.85%
Fibonacci (Full) 958.7±5.99µs 953.4±1.56µs +0.56%
For loop (Execution) 19.5±0.05µs 19.5±0.04µs 0.00%
For loop (Full) 234.4±0.56µs 233.9±0.19µs +0.21%
For loop (Parser) 15.0±0.02µs 15.2±0.02µs -1.32%
Goal Symbols (Parser) 10.1±0.02µs 10.1±0.03µs 0.00%
Hello World (Parser) 2.7±0.00µs 2.7±0.06µs 0.00%
Long file (Parser) 690.7±0.94ns 696.3±0.63ns -0.80%
Mini js (Execution) 517.9±2.49µs 517.4±8.46µs +0.10%
Mini js (Full) 748.5±2.47µs 746.4±3.50µs +0.28%
Mini js (Parser) 26.9±0.02µs 26.8±0.05µs +0.37%
Number Object Access (Execution) 3.3±0.01µs 3.3±0.01µs 0.00%
Number Object Access (Full) 208.2±0.90µs 205.6±0.27µs +1.26%
Object Creation (Execution) 3.7±0.01µs 3.7±0.01µs 0.00%
Object Creation (Full) 208.2±0.50µs 208.0±0.33µs +0.10%
RegExp (Execution) 8.0±0.03µs 8.1±0.03µs -1.23%
RegExp (Full) 219.3±0.36µs 219.0±1.01µs +0.14%
RegExp Literal (Execution) 9.3±0.03µs 9.3±0.03µs 0.00%
RegExp Literal (Full) 216.2±0.27µs 218.3±0.43µs -0.96%
RegExp Literal Creation (Execution) 8.0±0.03µs 8.2±0.04µs -2.44%
RegExp Literal Creation (Full) 212.0±0.29µs 211.9±0.32µs +0.05%
Static Object Property Access (Execution) 3.9±0.03µs 3.9±0.01µs 0.00%
Static Object Property Access (Full) 211.1±5.28µs 210.8±2.26µs +0.14%
String Object Access (Execution) 5.8±0.01µs 5.8±0.01µs 0.00%
String Object Access (Full) 212.5±0.19µs 212.3±0.46µs +0.09%
String comparison (Execution) 5.5±0.02µs 5.6±0.02µs -1.79%
String comparison (Full) 215.5±2.54µs 214.3±0.24µs +0.56%
String concatenation (Execution) 4.4±0.01µs 4.4±0.01µs 0.00%
String concatenation (Full) 209.7±2.48µs 207.0±0.26µs +1.30%
String copy (Execution) 3.3±0.01µs 3.3±0.01µs 0.00%
String copy (Full) 203.0±0.23µs 204.8±0.29µs -0.88%
Symbols (Execution) 2.8±0.00µs 2.9±0.04µs -3.45%
Symbols (Full) 199.2±0.43µs 201.3±0.46µs -1.04%

boa_cli/src/helper.rs Outdated Show resolved Hide resolved
boa_cli/src/helper.rs Outdated Show resolved Hide resolved
Co-authored-by: Jevan Chan <jevan.cnchan@gmail.com>
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Benchmark for 68d5c98

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 352.9±15.50ns 340.1±28.44ns +3.76%
Arithmetic operations (Full) 240.8±12.24µs 239.6±23.39µs +0.50%
Array access (Execution) 6.6±0.41µs 6.4±0.33µs +3.12%
Array access (Full) 266.6±10.87µs 263.7±9.96µs +1.10%
Array creation (Execution) 2.9±0.13ms 2.7±0.10ms +7.41%
Array creation (Full) 3.0±0.15ms 3.0±0.15ms 0.00%
Array pop (Execution) 925.9±41.16µs 897.8±45.17µs +3.13%
Array pop (Full) 1302.3±51.27µs 1276.9±45.98µs +1.99%
Boolean Object Access (Execution) 5.2±0.24µs 4.9±0.29µs +6.12%
Boolean Object Access (Full) 251.8±15.27µs 246.6±17.17µs +2.11%
Clean js (Execution) 712.8±32.11µs 650.0±30.10µs +9.66%
Clean js (Full) 946.3±51.60µs 931.0±39.16µs +1.64%
Clean js (Parser) 33.8±2.32µs 33.6±1.58µs +0.60%
Create Realm 497.4±16.75ns 465.7±23.75ns +6.81%
Dynamic Object Property Access (Execution) 5.5±0.26µs 5.2±0.42µs +5.77%
Dynamic Object Property Access (Full) 265.2±14.99µs 253.6±12.85µs +4.57%
Expression (Parser) 6.3±0.26µs 6.4±0.40µs -1.56%
Fibonacci (Execution) 929.3±33.12µs 865.1±27.78µs +7.42%
Fibonacci (Full) 1147.4±51.14µs 1136.1±44.74µs +0.99%
For loop (Execution) 23.6±1.33µs 22.6±1.16µs +4.42%
For loop (Full) 290.1±16.60µs 279.8±13.07µs +3.68%
For loop (Parser) 16.7±0.87µs 16.5±0.74µs +1.21%
Goal Symbols (Parser) 11.2±0.59µs 11.2±0.58µs 0.00%
Hello World (Parser) 2.9±0.12µs 3.0±0.13µs -3.33%
Long file (Parser) 742.4±32.40ns 752.9±112.14ns -1.39%
Mini js (Execution) 633.8±26.11µs 579.3±25.50µs +9.41%
Mini js (Full) 847.2±40.69µs 830.0±32.15µs +2.07%
Mini js (Parser) 29.8±2.07µs 29.8±1.36µs 0.00%
Number Object Access (Execution) 4.0±0.17µs 3.7±0.16µs +8.11%
Number Object Access (Full) 263.8±17.74µs 242.1±9.78µs +8.96%
Object Creation (Execution) 4.7±0.27µs 4.6±0.28µs +2.17%
Object Creation (Full) 258.9±12.69µs 250.9±10.44µs +3.19%
RegExp (Execution) 9.5±0.43µs 9.2±0.52µs +3.26%
RegExp (Full) 281.0±15.16µs 261.7±13.90µs +7.37%
RegExp Literal (Execution) 11.1±0.63µs 11.6±0.69µs -4.31%
RegExp Literal (Full) 276.6±21.90µs 261.6±16.42µs +5.73%
RegExp Literal Creation (Execution) 9.7±0.52µs 9.2±0.45µs +5.43%
RegExp Literal Creation (Full) 255.6±11.44µs 260.6±10.82µs -1.92%
Static Object Property Access (Execution) 5.2±0.24µs 4.8±0.76µs +8.33%
Static Object Property Access (Full) 255.6±12.92µs 248.1±11.95µs +3.02%
String Object Access (Execution) 7.2±0.39µs 6.9±0.33µs +4.35%
String Object Access (Full) 252.6±11.59µs 249.9±8.85µs +1.08%
String comparison (Execution) 6.9±0.51µs 6.6±0.37µs +4.55%
String comparison (Full) 265.7±10.74µs 267.7±51.63µs -0.75%
String concatenation (Execution) 5.4±0.28µs 5.4±0.22µs 0.00%
String concatenation (Full) 268.6±12.94µs 253.4±25.02µs +6.00%
String copy (Execution) 4.3±0.26µs 4.1±0.26µs +4.88%
String copy (Full) 257.9±13.69µs 244.3±9.41µs +5.57%
Symbols (Execution) 3.8±0.16µs 3.7±0.19µs +2.70%
Symbols (Full) 260.8±15.39µs 234.2±10.71µs +11.36%

Co-authored-by: Jevan Chan <jevan.cnchan@gmail.com>
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Benchmark for 5c44a44

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 365.2±2.80ns 365.9±0.87ns -0.19%
Arithmetic operations (Full) 241.8±18.10µs 240.7±4.47µs +0.46%
Array access (Execution) 6.3±0.02µs 6.7±0.57µs -5.97%
Array access (Full) 257.0±1.00µs 259.2±2.44µs -0.85%
Array creation (Execution) 3.1±0.03ms 3.1±0.01ms 0.00%
Array creation (Full) 3.3±0.01ms 3.4±0.02ms -2.94%
Array pop (Execution) 983.7±10.66µs 987.6±6.36µs -0.39%
Array pop (Full) 1479.1±90.68µs 1441.9±15.27µs +2.58%
Boolean Object Access (Execution) 5.0±0.02µs 5.0±0.02µs 0.00%
Boolean Object Access (Full) 249.7±1.59µs 253.5±2.50µs -1.50%
Clean js (Execution) 695.7±8.55µs 694.9±4.29µs +0.12%
Clean js (Full) 987.0±6.36µs 992.6±12.96µs -0.56%
Clean js (Parser) 34.6±0.12µs 34.7±0.55µs -0.29%
Create Realm 506.2±2.72ns 497.7±3.45ns +1.71%
Dynamic Object Property Access (Execution) 5.1±0.02µs 5.2±0.18µs -1.92%
Dynamic Object Property Access (Full) 252.6±0.71µs 257.4±1.64µs -1.86%
Expression (Parser) 6.5±0.30µs 6.8±0.03µs -4.41%
Fibonacci (Execution) 859.6±3.70µs 857.5±6.37µs +0.24%
Fibonacci (Full) 1130.9±13.33µs 1139.7±3.27µs -0.77%
For loop (Execution) 23.5±0.19µs 23.2±0.21µs +1.29%
For loop (Full) 279.9±1.72µs 278.1±0.99µs +0.65%
For loop (Parser) 17.4±0.05µs 17.3±0.05µs +0.58%
Goal Symbols (Parser) 11.7±0.03µs 11.8±0.07µs -0.85%
Hello World (Parser) 3.0±0.08µs 3.1±0.01µs -3.23%
Long file (Parser) 804.7±5.60ns 801.1±4.60ns +0.45%
Mini js (Execution) 621.1±5.22µs 620.6±3.94µs +0.08%
Mini js (Full) 897.3±8.11µs 892.4±5.62µs +0.55%
Mini js (Parser) 30.4±0.14µs 30.6±0.17µs -0.65%
Number Object Access (Execution) 4.0±0.01µs 4.2±1.15µs -4.76%
Number Object Access (Full) 249.0±1.26µs 247.5±1.89µs +0.61%
Object Creation (Execution) 4.4±0.03µs 4.4±0.04µs 0.00%
Object Creation (Full) 248.3±1.21µs 249.8±1.15µs -0.60%
RegExp (Execution) 9.6±0.03µs 9.7±0.07µs -1.03%
RegExp (Full) 264.1±4.27µs 263.3±1.45µs +0.30%
RegExp Literal (Execution) 11.1±0.05µs 11.2±0.27µs -0.89%
RegExp Literal (Full) 260.5±2.41µs 261.7±1.07µs -0.46%
RegExp Literal Creation (Execution) 9.6±0.05µs 9.7±0.04µs -1.03%
RegExp Literal Creation (Full) 253.8±1.72µs 254.0±1.30µs -0.08%
Static Object Property Access (Execution) 4.7±0.02µs 4.7±0.03µs 0.00%
Static Object Property Access (Full) 252.6±0.72µs 251.3±0.92µs +0.52%
String Object Access (Execution) 7.1±0.26µs 6.9±0.03µs +2.90%
String Object Access (Full) 255.7±0.72µs 255.0±1.26µs +0.27%
String comparison (Execution) 6.7±0.04µs 6.5±0.09µs +3.08%
String comparison (Full) 258.0±1.15µs 254.0±1.61µs +1.57%
String concatenation (Execution) 5.3±0.15µs 5.3±0.08µs 0.00%
String concatenation (Full) 251.3±1.71µs 248.5±1.38µs +1.13%
String copy (Execution) 4.0±0.02µs 4.0±0.04µs 0.00%
String copy (Full) 248.2±8.55µs 242.8±1.29µs +2.22%
Symbols (Execution) 3.4±0.06µs 3.4±0.02µs 0.00%
Symbols (Full) 239.1±1.70µs 239.7±1.19µs -0.25%

@Razican Razican merged commit ba84f52 into master Jan 8, 2021
@RageKnify RageKnify deleted the number_highlighting branch January 8, 2021 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Boa command line interface. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants