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 keyword and operator colors and matching bracket validator to cli #590

Merged
merged 1 commit into from
Jul 25, 2020

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Jul 23, 2020

This Pull Request fixes/closes #341 .

It changes the following:

  • Made readline "> " to ">> ", looks much nicer ;)
  • Added color to keywords (bold yellow)
  • Added color to reserved words (true, false, Infinity) purple color
  • Added color to undefined gray
  • Added matching bracket validation (the cli will wait untill closing }, ), ]) so we can do something like:
function x() {
let y = 3;
}

Example: some dummy code:
Screenshot_2020-07-23_09-26-41
The line 5 undefined is not colored because it is not part of the line that is being read, its output from forward_val

BTW: we can change the colors at any time :)

@HalidOdat HalidOdat added enhancement New feature or request cli Issues and PRs related to the Boa command line interface. labels Jul 23, 2020
@HalidOdat HalidOdat added this to the v0.10.0 milestone Jul 23, 2020
@HalidOdat HalidOdat added the blocked Waiting for another code change label Jul 23, 2020
@HalidOdat HalidOdat changed the title Added keyword and operator colors and matching bracket validator Added keyword and operator colors and matching bracket validator to cli Jul 23, 2020
@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #590 into master will decrease coverage by 0.08%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #590      +/-   ##
==========================================
- Coverage   71.13%   71.04%   -0.09%     
==========================================
  Files         177      177              
  Lines       11425    11439      +14     
==========================================
  Hits         8127     8127              
- Misses       3298     3312      +14     
Impacted Files Coverage Δ
boa_cli/src/main.rs 5.88% <0.00%> (-27.46%) ⬇️

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 795adc5...c83190e. Read the comment docs.

@github-actions
Copy link

Benchmark for 1b9975e

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 346.1±28.38ns 357.9±16.65ns -3.30%
Arithmetic operations (Full) 156.4±7.02µs 163.0±9.04µs -4.05%
Array access (Execution) 13.4±0.70µs 12.6±0.83µs +6.35%
Array access (Full) 182.6±6.97µs 180.9±10.09µs +0.94%
Array creation (Execution) 3.6±0.13ms 3.7±0.12ms -2.70%
Array creation (Full) 3.9±0.14ms 4.0±0.15ms -2.50%
Array pop (Execution) 1385.7±68.43µs 1418.1±92.04µs -2.28%
Array pop (Full) 1680.1±108.69µs 1726.4±64.14µs -2.68%
Boolean Object Access (Execution) 4.3±0.23µs 4.0±0.16µs +7.50%
Boolean Object Access (Full) 169.7±8.21µs 166.3±7.52µs +2.04%
Create Realm 155.0±4.95µs 143.8±11.62µs +7.79%
Dynamic Object Property Access (Execution) 6.4±0.40µs 6.2±0.26µs +3.23%
Dynamic Object Property Access (Full) 166.9±8.26µs 166.3±7.21µs +0.36%
Expression (Lexer) 2.2±0.12µs 2.2±0.09µs 0.00%
Expression (Parser) 5.0±0.34µs 5.2±0.30µs -3.85%
Fibonacci (Execution) 934.4±35.48µs 884.6±46.46µs +5.63%
Fibonacci (Full) 1101.0±71.99µs 1117.4±57.32µs -1.47%
For loop (Execution) 21.4±1.31µs 20.7±1.03µs +3.38%
For loop (Full) 185.4±9.00µs 182.7±7.61µs +1.48%
For loop (Lexer) 4.8±0.26µs 5.0±0.28µs -4.00%
For loop (Parser) 13.4±1.16µs 13.4±0.65µs 0.00%
Goal Symbols (Parser) 7.9±0.43µs 8.2±0.34µs -3.66%
Hello World (Lexer) 754.2±43.22ns 779.3±26.90ns -3.22%
Hello World (Parser) 2.1±0.09µs 2.1±0.10µs 0.00%
Long file (Parser) 5.9±0.21ms 6.0±0.23ms -1.67%
Number Object Access (Execution) 3.2±0.21µs 3.1±0.16µs +3.23%
Number Object Access (Full) 160.3±8.00µs 162.5±8.19µs -1.35%
Object Creation (Execution) 5.3±0.32µs 5.5±0.22µs -3.64%
Object Creation (Full) 189.1±8.82µs 190.0±7.82µs -0.47%
RegExp (Execution) 63.1±6.19µs 63.5±2.81µs -0.63%
RegExp (Full) 233.4±10.84µs 243.2±9.83µs -4.03%
RegExp Literal (Execution) 69.3±4.00µs 66.6±4.28µs +4.05%
RegExp Literal (Full) 234.2±14.54µs 242.8±10.90µs -3.54%
RegExp Literal Creation (Execution) 62.5±3.50µs 62.8±4.15µs -0.48%
RegExp Literal Creation (Full) 283.7±14.75µs 285.8±11.44µs -0.73%
Static Object Property Access (Execution) 5.7±0.31µs 5.4±0.24µs +5.56%
Static Object Property Access (Full) 162.8±11.20µs 173.2±7.84µs -6.00%
String Object Access (Execution) 7.9±0.43µs 7.6±0.33µs +3.95%
String Object Access (Full) 169.2±10.74µs 169.8±6.54µs -0.35%
String comparison (Execution) 6.2±0.32µs 6.3±0.28µs -1.59%
String comparison (Full) 172.6±8.71µs 170.4±7.07µs +1.29%
String concatenation (Execution) 5.2±0.40µs 5.1±0.26µs +1.96%
String concatenation (Full) 167.4±6.37µs 162.6±7.50µs +2.95%
String copy (Execution) 4.3±0.19µs 4.0±0.14µs +7.50%
String copy (Full) 157.2±8.91µs 161.4±6.63µs -2.60%
Symbols (Execution) 3.5±0.21µs 3.4±0.25µs +2.94%
Symbols (Full) 157.1±8.08µs 155.0±7.59µs +1.35%

@HalidOdat HalidOdat removed the blocked Waiting for another code change label Jul 23, 2020
@HalidOdat HalidOdat force-pushed the feature/cli-color branch from 1567a74 to c83190e Compare July 23, 2020 19:28
@github-actions
Copy link

Benchmark for 6bfe7eb

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 383.8±4.92ns 406.5±18.89ns -5.58%
Arithmetic operations (Full) 168.2±2.88µs 181.2±12.76µs -7.17%
Array access (Execution) 14.0±0.42µs 14.8±0.51µs -5.41%
Array access (Full) 192.9±7.08µs 192.6±11.96µs +0.16%
Array creation (Execution) 3.9±0.09ms 4.1±0.21ms -4.88%
Array creation (Full) 4.2±0.10ms 4.7±0.47ms -10.64%
Array pop (Execution) 1612.8±90.44µs 1519.3±27.39µs +6.15%
Array pop (Full) 1825.7±56.07µs 2.0±0.17ms -8.72%
Boolean Object Access (Execution) 4.3±0.13µs 4.4±0.27µs -2.27%
Boolean Object Access (Full) 182.0±3.93µs 207.8±52.88µs -12.42%
Create Realm 155.8±1.86µs 167.9±6.79µs -7.21%
Dynamic Object Property Access (Execution) 7.2±0.41µs 7.2±0.25µs 0.00%
Dynamic Object Property Access (Full) 188.0±12.61µs 202.0±28.28µs -6.93%
Expression (Lexer) 2.4±0.05µs 2.5±0.34µs -4.00%
Expression (Parser) 5.5±0.15µs 5.9±0.52µs -6.78%
Fibonacci (Execution) 999.5±25.48µs 1181.7±173.26µs -15.42%
Fibonacci (Full) 1198.0±23.14µs 1309.3±184.59µs -8.50%
For loop (Execution) 23.0±0.38µs 23.7±0.86µs -2.95%
For loop (Full) 195.8±4.34µs 200.8±16.83µs -2.49%
For loop (Lexer) 5.2±0.08µs 5.4±0.40µs -3.70%
For loop (Parser) 14.1±0.28µs 14.8±0.87µs -4.73%
Goal Symbols (Parser) 8.6±0.19µs 8.7±0.21µs -1.15%
Hello World (Lexer) 826.4±11.06ns 874.7±60.97ns -5.52%
Hello World (Parser) 2.2±0.04µs 2.3±0.37µs -4.35%
Long file (Parser) 6.4±0.10ms 6.6±0.22ms -3.03%
Number Object Access (Execution) 3.4±0.07µs 3.7±0.34µs -8.11%
Number Object Access (Full) 179.1±4.92µs 203.7±34.09µs -12.08%
Object Creation (Execution) 6.1±0.52µs 6.2±0.38µs -1.61%
Object Creation (Full) 204.9±8.97µs 225.2±19.73µs -9.01%
RegExp (Execution) 68.6±2.01µs 69.7±1.90µs -1.58%
RegExp (Full) 265.7±13.59µs 291.6±36.74µs -8.88%
RegExp Literal (Execution) 72.0±1.99µs 73.9±2.02µs -2.57%
RegExp Literal (Full) 269.5±16.39µs 290.5±34.69µs -7.23%
RegExp Literal Creation (Execution) 72.3±6.51µs 70.5±2.55µs +2.55%
RegExp Literal Creation (Full) 328.7±27.14µs 335.1±29.95µs -1.91%
Static Object Property Access (Execution) 5.9±0.26µs 6.3±0.16µs -6.35%
Static Object Property Access (Full) 183.8±5.09µs 203.8±27.21µs -9.81%
String Object Access (Execution) 8.2±0.13µs 8.9±0.72µs -7.87%
String Object Access (Full) 188.3±12.79µs 200.1±15.38µs -5.90%
String comparison (Execution) 6.7±0.14µs 7.0±0.36µs -4.29%
String comparison (Full) 183.9±10.53µs 209.0±21.03µs -12.01%
String concatenation (Execution) 5.5±0.11µs 5.9±0.14µs -6.78%
String concatenation (Full) 178.1±2.49µs 197.3±25.27µs -9.73%
String copy (Execution) 4.2±0.03µs 4.8±0.67µs -12.50%
String copy (Full) 174.5±3.35µs 186.9±18.18µs -6.63%
Symbols (Execution) 3.7±0.09µs 4.2±0.31µs -11.90%
Symbols (Full) 169.5±7.46µs 172.8±15.52µs -1.91%

@HalidOdat HalidOdat merged commit 24a72ea into master Jul 25, 2020
@HalidOdat HalidOdat deleted the feature/cli-color branch July 25, 2020 20:48
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.

Ability to create multiline blocks in boa shell
1 participant