File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,4 +18,7 @@ func main() {
1818
1919 // print the value of num
2020 fmt .Println (numTest )
21+
22+ // a raw string keeps its content untouched
23+ fmt .Println (`SELECT "n" FROM nums WHERE n = 10` )
2124}
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ void run(List<Token>) {
4646
4747//main function
4848public static void main (String [] args ) {
49+ //the help text, written as a text block
50+ String help = """
51+ type an expression like "1+2+3"
52+ """ ;
4953 String s = "1+2+3" ;
5054 List <Token > tokensList = lexer (s );
5155 run (tokensList );
Original file line number Diff line number Diff line change 1010 We can include "]=]" inside this comment
1111f --]==]
1212
13+ --[[
14+ This is also a block comment
15+ It is closed without the dashes
16+ ]]
17+
1318vf -- tst
1419
1520a = ' alo\n 123"'
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ use std::net::{TcpListener, TcpStream};
77use std:: io:: { Read , Write } ;
88use std:: thread;
99
10+ //the greeting sent to every new client
11+ const GREETING : & ' static str = "hello" ;
12+
13+ //keep the message up to the first space
14+ fn first_word < ' a > ( msg : & ' a str ) -> & ' a str {
15+ msg. split ( ' ' ) . next ( ) . unwrap ( )
16+ }
17+
1018//function that handles the client
1119fn handle_client ( mut stream : TcpStream ) {
1220 //read the message
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ export default [
33 match : / \/ \/ .* \n ? | \/ \* ( (? ! \* \/ ) [ ^ ] ) * ( \* \/ ) ? / g,
44 sub : 'todo'
55 } ,
6+ {
7+ type : 'str' ,
8+ match : / ` [ ^ ` ] * ` ? / g
9+ } ,
610 {
711 expand : 'str'
812 } ,
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ export default [
33 match : / \/ \/ .* \n ? | \/ \* ( (? ! \* \/ ) [ ^ ] ) * ( \* \/ ) ? / g,
44 sub : 'todo'
55 } ,
6+ {
7+ type : 'str' ,
8+ match : / " " " ( \\ [ ^ ] | (? ! " " " ) [ ^ ] ) * ( " " " ) ? / g
9+ } ,
610 {
711 expand : 'str'
812 } ,
Original file line number Diff line number Diff line change 11export default [
22 {
3- match : / ^ # ! .* | - - ( \[ ( = * ) \[ [ ^ ] * ?- - \] \2\] | .* ) / g,
3+ match : / ^ # ! .* | - - ( \[ ( = * ) \[ [ ^ ] * ?\] \2\] | .* ) / g,
44 sub : 'todo'
55 } ,
66 {
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ export default [
33 match : / \/ \/ .* \n ? | \/ \* ( (? ! \* \/ ) [ ^ ] ) * ( \* \/ ) ? / g,
44 sub : 'todo'
55 } ,
6+ {
7+ // lifetime (ex: "'a")
8+ type : 'type' ,
9+ match : / ' [ a - z _ ] \w * (? ! ' ) / g
10+ } ,
611 {
712 expand : 'str'
813 } ,
You can’t perform that action at this time.
0 commit comments