Skip to content

Commit

Permalink
IchigoJam: Make strings greedy
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Dec 19, 2017
1 parent 60114d0 commit 37af500
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
5 changes: 4 additions & 1 deletion components/prism-ichigojam.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// according to the offical reference (EN)
// https://ichigojam.net/IchigoJam-en.html
Prism.languages.ichigojam = {
'string': /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,
'comment': /(?:\B'|REM)(?:[^\n\r]*)/i,
'string': {
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,
greedy: true
},
'number': /(?:\B#[0-9A-F]+)|(?:\B`[01]+)|(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,
'keyword': /\b(?:BEEP|BPS|CASE|CLEAR|CLK|CLO|CLP|CLS|CLT|CLV|CONT|COPY|ELSE|END|FILE|FILES|FOR|GOSUB|GSB|GOTO|IF|INPUT|KBD|LED|LET|LIST|LOAD|LOCATE|LRUN|NEW|NEXT|OUT|RIGHT|PLAY|POKE|PRINT|PWM|REM|RENUM|RESET|RETURN|RTN|RUN|SAVE|SCROLL|SLEEP|SRND|STEP|STOP|SUB|TEMPO|THEN|TO|UART|VIDEO|WAIT)(?:\$|\b)/i,
'function': /\b(?:ABS|ANA|ASC|BIN|BTN|DEC|END|FREE|HELP|HEX|I2CR|I2CW|IN|INKEY|LEN|LINE|PEEK|RND|SCR|SOUND|STR|TICK|USR|VER|VPEEK|ZER)(?:\$|\b)/i,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-ichigojam.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions examples/prism-ichigojam.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,4 @@ <h2>Numbers</h2>
<h2>IchigoJam Basic example</h2>
<pre><code>A=0
FOR I=1 TO 100 : A=A+I : NEXT
PRINT A</code></pre>

<h2>Known failures</h2>
<p>There are certain edge cases where Prism will fail.
There are always such cases in every regex-based syntax highlighter.
However, Prism dares to be open and honest about them.
If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>

<h3>Two double quotes inside a comment</h3>
<pre><code>! This "comment" is broken
REM This "remark" is broken</code></pre>
PRINT A</code></pre>

0 comments on commit 37af500

Please sign in to comment.