Skip to content

Commit

Permalink
Merge pull request #248 from gilch/raw-symbols
Browse files Browse the repository at this point in the history
Fragment syntax
  • Loading branch information
gilch authored Dec 26, 2023
2 parents 49d9531 + 6c7374e commit 9f40b23
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 170 deletions.
2 changes: 2 additions & 0 deletions docs/lissp_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def preprocess_atom(lexer, match, ctx=None):
pt.Punctuation, # close
pt.Operator, # macro
pt.String,
pt.String.Symbol,
pt.Error, # continue
pt.Error, # unclosed
using(AtomSubLexer),
pt.Error,
),
Expand Down
24 changes: 7 additions & 17 deletions docs/lissp_whirlwind_tour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,22 +357,18 @@ Lissp Whirlwind Tour

;;;; 6.3 String Literals

#> "raw string"
>>> ('raw string')
'raw string'
#> "a string"
>>> ('a string')
'a string'

#> 'not-string' ;symbol
>>> 'notQz_stringQzAPOS_'
'notQz_stringQzAPOS_'

#> #"Say \"Cheese!\" \u263a" ;Hash strings process Python escapes.
#> "Say \"Cheese!\" \u263a" ;Python escape sequences.
>>> ('Say "Cheese!" ☺')
'Say "Cheese!" ☺'

#> "Say \"Cheese!\" \u263a" ;Raw strings don't.
>>> ('Say \\"Cheese!\\" \\u263a')
'Say \\"Cheese!\\" \\u263a'


#> "string
#..with
Expand All @@ -382,12 +378,6 @@ Lissp Whirlwind Tour
'string\nwith\nnewlines\n'


#> "one\"
#..string\\" ;Tokenizer expects paired \'s, even raw.
>>> ('one\\"\nstring\\\\')
'one\\"\nstring\\\\'


;;;; 7 Advanced Calls

#> (dict :) ;Left paren before function! Notice the :.
Expand Down Expand Up @@ -443,7 +433,7 @@ Lissp Whirlwind Tour
#.. :* "xyz" ;:* is a repeatable positional target.
#.. :** (dict : sep "-") ;Target :** to unpack mapping.
#.. flush True ;Kwargs still allowed after :**.
#.. :** (dict : end #"!?\n")) ;Multiple :** allowed too.
#.. :** (dict : end "!?\n")) ;Multiple :** allowed too.
>>> print(
... (1),
... *('abc'),
Expand Down Expand Up @@ -1629,14 +1619,14 @@ Lissp Whirlwind Tour

;; Finds spam.lissp & eggs.lissp in the current package & compile to spam.py & eggs.py
#> (.write_text (pathlib..Path "eggs.lissp")
#.. #"(print \"Hello World!\")")
#.. "(print \"Hello World!\")")
>>> __import__('pathlib').Path(
... ('eggs.lissp')).write_text(
... ('(print "Hello World!")'))
22

#> (.write_text (pathlib..Path "spam.lissp")
#.. #"(print \"Hello from spam!\")
#.. "(print \"Hello from spam!\")
#..(.update (globals) : x 42)")
>>> __import__('pathlib').Path(
... ('spam.lissp')).write_text(
Expand Down
Loading

0 comments on commit 9f40b23

Please sign in to comment.