Skip to content

Commit 637a35f

Browse files
authored
Merge pull request #77 from lvolland/fix/delimiters-rs-go-java-lua
fix: delimiters in rs, go, java and lua
2 parents 4a00a94 + 3f51d24 commit 637a35f

8 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎examples/languages/test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

‎examples/languages/test.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ void run(List<Token>) {
4646

4747
//main function
4848
public 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);

‎examples/languages/test.lua‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
We can include "]=]" inside this comment
1111
f --]==]
1212

13+
--[[
14+
This is also a block comment
15+
It is closed without the dashes
16+
]]
17+
1318
vf --tst
1419

1520
a = 'alo\n123"'

‎examples/languages/test.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ use std::net::{TcpListener, TcpStream};
77
use std::io::{Read, Write};
88
use 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
1119
fn handle_client(mut stream: TcpStream) {
1220
//read the message

‎src/languages/go.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
},

‎src/languages/java.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
},

‎src/languages/lua.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default [
22
{
3-
match: /^#!.*|--(\[(=*)\[[^]*?--\]\2\]|.*)/g,
3+
match: /^#!.*|--(\[(=*)\[[^]*?\]\2\]|.*)/g,
44
sub: 'todo'
55
},
66
{

‎src/languages/rs.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
},

0 commit comments

Comments
 (0)