multiline comments are hella gay
This commit is contained in:
parent
b25838a1a8
commit
5062b3aebe
@ -70,37 +70,6 @@ pub fn tokenize(source: &str) -> Vec<Token> {
|
||||
}
|
||||
current += 1;
|
||||
}
|
||||
} else if chars.get(current + 1) == Some(&'*') {
|
||||
let mut depth = 1;
|
||||
'comment: loop {
|
||||
if chars.get(current) == Some(&'*')
|
||||
&& chars.get(current + 1) == Some(&'/')
|
||||
{
|
||||
depth -= 1;
|
||||
if depth == 0 {
|
||||
break 'comment;
|
||||
}
|
||||
}
|
||||
if chars.get(current) == Some(&'/')
|
||||
&& chars.get(current + 1) == Some(&'*')
|
||||
{
|
||||
depth += 1;
|
||||
} else if chars.get(current) == None {
|
||||
break 'comment;
|
||||
} else {
|
||||
current += 1;
|
||||
}
|
||||
}
|
||||
// 'comment: loop {
|
||||
// if (chars.get(current) == Some(&'/')
|
||||
// && chars.get(current - 1) == Some(&'*'))
|
||||
// || chars.get(current) == None
|
||||
// {
|
||||
// current += 1;
|
||||
// break 'comment;
|
||||
// }
|
||||
// current += 1;
|
||||
// }
|
||||
} else {
|
||||
current += 1;
|
||||
}
|
||||
|
30
test.pvt
30
test.pvt
@ -1,21 +1,19 @@
|
||||
// A comment
|
||||
|
||||
/* A multi-line
|
||||
comment! */
|
||||
// An implicit int.
|
||||
log(2);
|
||||
// An explicit int.
|
||||
log(5i);
|
||||
|
||||
/*
|
||||
A multi-line comment!
|
||||
// An implicit float.
|
||||
log(2.5);
|
||||
// An explicit float.
|
||||
log(3f);
|
||||
|
||||
/*
|
||||
A nested multi-line comment!
|
||||
*/
|
||||
// Booleans and multiple arguments.
|
||||
log(true, false);
|
||||
|
||||
*/
|
||||
|
||||
log(2); // An implicit int.
|
||||
log(5i); // An explicit int.
|
||||
log(2.5); // An implicit float.
|
||||
log(3f); // An explicit float.
|
||||
log(true, false); // Logging two things in one log call, and booleans.
|
||||
log("Hello world!"); // A string literal.
|
||||
log("What's that over there?"); // A string showing how different delimiters layer.
|
||||
// Strings.
|
||||
log("Hello world!");
|
||||
// A string showing how different delimiters layer.
|
||||
log("What's that over there?");
|
||||
|
Loading…
x
Reference in New Issue
Block a user