diff --git a/autotests/folding/highlight.y.fold b/autotests/folding/highlight.y.fold index 4f6242b..9eb3220 100644 --- a/autotests/folding/highlight.y.fold +++ b/autotests/folding/highlight.y.fold @@ -1,93 +1,95 @@ /* Yacc / Bison hl test file. * It won't compile :-) Sure ! */ %{ #include using namespace std; extern KateParser *parser; %} %locations %union { int int_val; double double_val; bool bool_val; char *string_val; char *ident_val; struct var *v; void *ptr; } %token TOK_NOT_EQUAL "!=" %token TOK_LESSER_E "<=" %token TOK_GREATER_E ">=" %token TOK_EQUAL_2 "==" //comment %token PERCENT_DEBUG "%debug" PERCENT_DEFAULT_PREC "%default-prec" PERCENT_DEFINE "%define" ; %type type type_proc %code top { #define _GNU_SOURCE #include int val; } %destructor { free ($$); printf ("%d", @$.first_line); } <*> %lex-param {scanner_mode *mode}; %parse-param {int *nastiness} {int *randomness} %initial-action { @$.initialize (file_name); }; %%%% prog: KW_PROGRAM ident { parser->start($2); } prog_beg_glob_decl instructions { parser->endproc(0); } dev_procedures KW_ENDP ; number: integer_number | TOK_DOUBLE { $$ = new var; $$->type = KW_REEL; $$->cl = var::LITTERAL; $$->real = $1; }; words: %empty | words word ; %type word; %printer { fprintf (yyo, "%s", word_string ($$)); } ; word: %?{ boom(1); } | "hello" { $$ = hello; } | "bye" { $$ = bye; } ; foo: { $$ = 0 } | number { $$ = $1 | $2; } | hello { $$ = $1 | $3; } // without a comma hello: gram1 { $$ = "hi" }; | gram2 ;; %%%% #include int main(void) { puts("Hello, World!"); return 0; } + +// ALERT NOTE diff --git a/autotests/folding/test.rs.fold b/autotests/folding/test.rs.fold index 7e43837..74ceb9f 100644 --- a/autotests/folding/test.rs.fold +++ b/autotests/folding/test.rs.fold @@ -1,87 +1,87 @@ -// Comment -/* Comment +// Comment NOTE +/* Comment FIXME ALERT */ // Identifiers hellóñαωΑΩµo!(); HellóñαωΑΩµ::Hello; 'hellóñαωΑΩµo pub use self::PathParameters::*; pub use symbol::{Ident, Symbol as Name}; use serialize::{self, Encoder, Decoder}; use std::u32; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct Lifetime { pub id: NodeId, pub span: Span, pub bounds: Vec } impl fmt::Debug for Lifetime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "lifetime({}: {})", self.id, pprust::lifetime_to_string(self)) } } impl<'a> PartialEq<&'a str> for Path { fn eq(&self, string: &&'a str) -> bool { self.segments.len() == 1 && self.segments[0].identifier.name == *string } } enum TraitBoundModifier { None, Maybe, } union tests { a: i128, b: isize, } #[valid types] fn types() { let num = 333_3_; let num_u8: u8 = 333u8; let num_u16: u16 = 333u16; let num_u32: u32 = 333u32; let num_u64: u64 = 333u64; let num_u128: u128 = 333u128; let num_usize: usize = 333usize; let num_float: f32 = 333.45f32; let binary = 0b1_010; let invalid_binary= 0b1_015; let octal = 0o21535; let invalid_octal = 0o64_92; let hexadecimal = 0x73A2_F; let invalid_hexadecimal = 0x7_3AY; let char1: char = 'a'; let char2: char = '\n'; let char3: char = '\u{123_AF}'; let invalid_char1: char = '\y'; let invalid_char2: char = '\324'; let invalid_char3: char = '%%'; let invalid_char4: char = '\n\dfd'; let invalid_char5: char = 'aaaaa'; let open_char: char = '&&&; let byte1: u8 = b'a'; let byte2: u8 = b'\x13'; let invalid_byte1: u8 = b'ab'; let invalid_byte2: u8 = b'\b'; let invalid_byte2: u8 = b'\u{123}'; let string: str = "hello \n \r \u{123_________fd_} \ bye"; let invalid_string: str = "hello \b \u{_123} \u{1234567} \ bye"; let byte_string: str = b"hello \t \0 \u{123} \b bye"; let raw_string1: str = r"hello \t \b"; let raw_string2: str = r####"hello \n "### bye"########; let raw_string3: str = br####"hello \n"####; } diff --git a/autotests/html/highlight.y.html b/autotests/html/highlight.y.html index a11c230..e04c49d 100644 --- a/autotests/html/highlight.y.html +++ b/autotests/html/highlight.y.html @@ -1,100 +1,102 @@ highlight.y
 /* Yacc / Bison hl test file.
  * It won't compile :-) Sure !
  */
 
 %{
 
 #include <iostream>
 using namespace std;
 
 extern KateParser *parser;
 
 %}
 
 %locations
 
 %union { 
    int int_val;
    double double_val;
    bool bool_val;
    char *string_val;
    char *ident_val;
    struct var *v;
    void *ptr;
 }
 
 %token <int_val>      TOK_NOT_EQUAL  "!="
 %token <int_val>      TOK_LESSER_E   "<="
 %token <int_val>      TOK_GREATER_E  ">="
 %token <int_val>      TOK_EQUAL_2    "==" //comment
 %token
    PERCENT_DEBUG           "%debug"
    PERCENT_DEFAULT_PREC    "%default-prec"
    PERCENT_DEFINE          "%define"
 ;
 
 %type <int_val>       type type_proc
 
 %code top {
   #define _GNU_SOURCE
   #include <stdio.h>
   int val;
 }
 
 %destructor { free ($$); printf ("%d", @$.first_line); } <*>
 %lex-param   {scanner_mode *mode};
 %parse-param {int *nastiness} {int *randomness}
 %initial-action {
   @$.initialize (file_name);
 };
 
 %%
 
 prog:                 KW_PROGRAM ident { parser->start($2); } prog_beg_glob_decl instructions { parser->endproc(0); } dev_procedures KW_ENDP ;
 
 number:               integer_number
                       | TOK_DOUBLE
                       {
                          $$ = new var;
                          $$->type = KW_REEL;
                          $$->cl = var::LITTERAL;
                          $$->real = $<int_val>1;
                       };
 words:
                       %empty
                       | words word
                       ;
 
 %type <type> word;
 %printer { fprintf (yyo, "%s", word_string ($$)); } <type>;
 word:
                       %?{ boom(1); }
                       | "hello"  { $$ = hello; }
                       | "bye"  { $$ = bye; }
                       ;
 
 foo:                  { $$ = 0 }
                       | number { $$ = $1 | $2; }
                       | hello { $$ = $1 | $3; } // without a comma
 
 hello:
                       gram1 { $$ = "hi" };
                       | gram2
                       ;;
                       
 %%
 
 #include <stdio.h>
 
 int main(void)
 {
   puts("Hello, World!");
   return 0;
 }
+
+// ALERT NOTE
 
diff --git a/autotests/html/test.rs.html b/autotests/html/test.rs.html index dd4da52..2d6bb4d 100644 --- a/autotests/html/test.rs.html +++ b/autotests/html/test.rs.html @@ -1,94 +1,94 @@ test.rs
-// Comment
-/* Comment
+// Comment NOTE
+/* Comment FIXME ALERT
 	*/
 
 // Identifiers
 hellóñαωΑΩµo!();
 HellóñαωΑΩµ::Hello;
 'hellóñαωΑΩµo
 
 pub use self::PathParameters::*;
 pub use symbol::{Ident, Symbol as Name};
 use serialize::{self, Encoder, Decoder};
 use std::u32;
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 
 pub struct Lifetime {
 	pub id: NodeId,
 	pub span: Span,
 	pub bounds: Vec<PathSegment>
 }
 
 impl fmt::Debug for Lifetime {
 	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 		write!(f, "lifetime({}: {})", self.id, pprust::lifetime_to_string(self))
 	}
 }
 impl<'a> PartialEq<&'a str> for Path {
 	fn eq(&self, string: &&'a str) -> bool {
 		self.segments.len() == 1 && self.segments[0].identifier.name == *string
 	}
 }
 
 enum TraitBoundModifier {
 	None,
 	Maybe,
 }
 
 union tests {
 	a: i128,
 	b: isize,
 }
 
 #[valid types]
 fn types() {
 	let num = 333_3_;
 	let num_u8: u8 = 333u8;
 	let num_u16: u16 = 333u16;
 	let num_u32: u32 = 333u32;
 	let num_u64: u64 = 333u64;
 	let num_u128: u128 = 333u128;
 	let num_usize: usize = 333usize;
 	let num_float: f32 = 333.45f32;
 
 	let binary = 0b1_010;
 	let invalid_binary= 0b1_015;
 
 	let octal = 0o21535;
 	let invalid_octal = 0o64_92;
 
 	let hexadecimal = 0x73A2_F;
 	let invalid_hexadecimal = 0x7_3AY;
 
 	let char1: char = 'a';
 	let char2: char = '\n';
 	let char3: char = '\u{123_AF}';
 	let invalid_char1: char = '\y';
 	let invalid_char2: char = '\324';
 	let invalid_char3: char = '%%';
 	let invalid_char4: char = '\n\dfd';
 	let invalid_char5: char = 'aaaaa';
 	let open_char: char = '&&&;
 
 	let byte1: u8 = b'a';
 	let byte2: u8 = b'\x13';
 	let invalid_byte1: u8 = b'ab';
 	let invalid_byte2: u8 = b'\b';
 	let invalid_byte2: u8 = b'\u{123}';
 
 	let string: str = "hello \n \r \u{123_________fd_} \
 						bye";
 	let invalid_string: str = "hello \b \u{_123} \u{1234567} \  bye";
 	let byte_string: str = b"hello \t \0 \u{123} \b bye";
 	let raw_string1: str = r"hello \t \b";
 	let raw_string2: str = r####"hello \n "### bye"########;
 	let raw_string3: str = br####"hello \n"####;
 }
 
diff --git a/autotests/input/highlight.y b/autotests/input/highlight.y index df42a54..06b3165 100644 --- a/autotests/input/highlight.y +++ b/autotests/input/highlight.y @@ -1,93 +1,95 @@ /* Yacc / Bison hl test file. * It won't compile :-) Sure ! */ %{ #include using namespace std; extern KateParser *parser; %} %locations %union { int int_val; double double_val; bool bool_val; char *string_val; char *ident_val; struct var *v; void *ptr; } %token TOK_NOT_EQUAL "!=" %token TOK_LESSER_E "<=" %token TOK_GREATER_E ">=" %token TOK_EQUAL_2 "==" //comment %token PERCENT_DEBUG "%debug" PERCENT_DEFAULT_PREC "%default-prec" PERCENT_DEFINE "%define" ; %type type type_proc %code top { #define _GNU_SOURCE #include int val; } %destructor { free ($$); printf ("%d", @$.first_line); } <*> %lex-param {scanner_mode *mode}; %parse-param {int *nastiness} {int *randomness} %initial-action { @$.initialize (file_name); }; %% prog: KW_PROGRAM ident { parser->start($2); } prog_beg_glob_decl instructions { parser->endproc(0); } dev_procedures KW_ENDP ; number: integer_number | TOK_DOUBLE { $$ = new var; $$->type = KW_REEL; $$->cl = var::LITTERAL; $$->real = $1; }; words: %empty | words word ; %type word; %printer { fprintf (yyo, "%s", word_string ($$)); } ; word: %?{ boom(1); } | "hello" { $$ = hello; } | "bye" { $$ = bye; } ; foo: { $$ = 0 } | number { $$ = $1 | $2; } | hello { $$ = $1 | $3; } // without a comma hello: gram1 { $$ = "hi" }; | gram2 ;; %% #include int main(void) { puts("Hello, World!"); return 0; } + +// ALERT NOTE diff --git a/autotests/input/test.rs b/autotests/input/test.rs index ec0d188..9da7b47 100644 --- a/autotests/input/test.rs +++ b/autotests/input/test.rs @@ -1,87 +1,87 @@ -// Comment -/* Comment +// Comment NOTE +/* Comment FIXME ALERT */ // Identifiers hellóñαωΑΩµo!(); HellóñαωΑΩµ::Hello; 'hellóñαωΑΩµo pub use self::PathParameters::*; pub use symbol::{Ident, Symbol as Name}; use serialize::{self, Encoder, Decoder}; use std::u32; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct Lifetime { pub id: NodeId, pub span: Span, pub bounds: Vec } impl fmt::Debug for Lifetime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "lifetime({}: {})", self.id, pprust::lifetime_to_string(self)) } } impl<'a> PartialEq<&'a str> for Path { fn eq(&self, string: &&'a str) -> bool { self.segments.len() == 1 && self.segments[0].identifier.name == *string } } enum TraitBoundModifier { None, Maybe, } union tests { a: i128, b: isize, } #[valid types] fn types() { let num = 333_3_; let num_u8: u8 = 333u8; let num_u16: u16 = 333u16; let num_u32: u32 = 333u32; let num_u64: u64 = 333u64; let num_u128: u128 = 333u128; let num_usize: usize = 333usize; let num_float: f32 = 333.45f32; let binary = 0b1_010; let invalid_binary= 0b1_015; let octal = 0o21535; let invalid_octal = 0o64_92; let hexadecimal = 0x73A2_F; let invalid_hexadecimal = 0x7_3AY; let char1: char = 'a'; let char2: char = '\n'; let char3: char = '\u{123_AF}'; let invalid_char1: char = '\y'; let invalid_char2: char = '\324'; let invalid_char3: char = '%%'; let invalid_char4: char = '\n\dfd'; let invalid_char5: char = 'aaaaa'; let open_char: char = '&&&; let byte1: u8 = b'a'; let byte2: u8 = b'\x13'; let invalid_byte1: u8 = b'ab'; let invalid_byte2: u8 = b'\b'; let invalid_byte2: u8 = b'\u{123}'; let string: str = "hello \n \r \u{123_________fd_} \ bye"; let invalid_string: str = "hello \b \u{_123} \u{1234567} \ bye"; let byte_string: str = b"hello \t \0 \u{123} \b bye"; let raw_string1: str = r"hello \t \b"; let raw_string2: str = r####"hello \n "### bye"########; let raw_string3: str = br####"hello \n"####; } diff --git a/autotests/reference/highlight.y.ref b/autotests/reference/highlight.y.ref index b3defa7..21b5caf 100644 --- a/autotests/reference/highlight.y.ref +++ b/autotests/reference/highlight.y.ref @@ -1,93 +1,95 @@ /* Yacc / Bison hl test file.
* It won't compile :-) Sure !
*/

%{

#include
using namespace std;

extern KateParser *parser;

%}

%locations

%union {
int int_val;
double double_val;
bool bool_val;
char *string_val;
char *ident_val;
struct var *v;
void *ptr;
}

%token TOK_NOT_EQUAL "!="
%token TOK_LESSER_E "<="
%token TOK_GREATER_E ">="
%token TOK_EQUAL_2 "==" //comment
%token
PERCENT_DEBUG "%debug"
PERCENT_DEFAULT_PREC "%default-prec"
PERCENT_DEFINE "%define"
;

%type type type_proc

%code top {
#define _GNU_SOURCE
#include
int val;
}

%destructor { free ($$); printf ("%d", @$.first_line); } <*>
%lex-param {scanner_mode *mode};
%parse-param {int *nastiness} {int *randomness}
%initial-action {
@$.initialize (file_name);
};

%%

prog: KW_PROGRAM ident { parser->start($2); } prog_beg_glob_decl instructions { parser->endproc(0); } dev_procedures KW_ENDP ;

number: integer_number
| TOK_DOUBLE
{
$$ = new var;
$$->type = KW_REEL;
$$->cl = var::LITTERAL;
$$->real = $1;
};
words:
%empty
| words word
;

%type word;
%printer { fprintf (yyo, "%s", word_string ($$)); } ;
word:
%?{ boom(1); }
| "hello" { $$ = hello; }
| "bye" { $$ = bye; }
;

foo: { $$ = 0 }
| number { $$ = $1 | $2; }
| hello { $$ = $1 | $3; } // without a comma

hello:
gram1 { $$ = "hi" };
| gram2
;;

%%

#include

int main(void)
{
puts("Hello, World!");
return 0;
}
+
+// ALERT NOTE
diff --git a/autotests/reference/test.rs.ref b/autotests/reference/test.rs.ref index 9a27445..8faadb3 100644 --- a/autotests/reference/test.rs.ref +++ b/autotests/reference/test.rs.ref @@ -1,87 +1,87 @@ -// Comment
-/* Comment
+// Comment NOTE
+/* Comment FIXME ALERT
*/

// Identifiers
hellóñαωΑΩµo!();
HellóñαωΑΩµ::Hello;
'hellóñαωΑΩµo

pub use self::PathParameters::*;
pub use symbol::{Ident, Symbol as Name};
use serialize::{self, Encoder, Decoder};
use std::u32;

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]

pub struct Lifetime {
pub id: NodeId,
pub span: Span,
pub bounds: Vec
}

impl fmt::Debug for Lifetime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "lifetime({}: {})", self.id, pprust::lifetime_to_string(self))
}
}
impl<'a> PartialEq<&'a str> for Path {
fn eq(&self, string: &&'a str) -> bool {
self.segments.len() == 1 && self.segments[0].identifier.name == *string
}
}

enum TraitBoundModifier {
None,
Maybe,
}

union tests {
a: i128,
b: isize,
}

#[valid types]
fn types() {
let num = 333_3_;
let num_u8: u8 = 333u8;
let num_u16: u16 = 333u16;
let num_u32: u32 = 333u32;
let num_u64: u64 = 333u64;
let num_u128: u128 = 333u128;
let num_usize: usize = 333usize;
let num_float: f32 = 333.45f32;

let binary = 0b1_010;
let invalid_binary= 0b1_015;

let octal = 0o21535;
let invalid_octal = 0o64_92;

let hexadecimal = 0x73A2_F;
let invalid_hexadecimal = 0x7_3AY;

let char1: char = 'a';
let char2: char = '\n';
let char3: char = '\u{123_AF}';
let invalid_char1: char = '\y';
let invalid_char2: char = '\324';
let invalid_char3: char = '%%';
let invalid_char4: char = '\n\dfd';
let invalid_char5: char = 'aaaaa';
let open_char: char = '&&&;

let byte1: u8 = b'a';
let byte2: u8 = b'\x13';
let invalid_byte1: u8 = b'ab';
let invalid_byte2: u8 = b'\b';
let invalid_byte2: u8 = b'\u{123}';

let string: str = "hello \n \r \u{123_________fd_} \
bye";
let invalid_string: str = "hello \b \u{_123} \u{1234567} \ bye";
let byte_string: str = b"hello \t \0 \u{123} \b bye";
let raw_string1: str = r"hello \t \b";
let raw_string2: str = r####"hello \n "### bye"########;
let raw_string3: str = br####"hello \n"####;
}
diff --git a/data/syntax/rust.xml b/data/syntax/rust.xml index 6657cf2..1733c29 100644 --- a/data/syntax/rust.xml +++ b/data/syntax/rust.xml @@ -1,374 +1,379 @@ ]> - + fn type abstract alignof as become box break const continue crate default do else enum extern final for if impl in let loop macro match mod move mut offsetof override priv proc pub pure ref return Self self sizeof static struct super trait type typeof union unsafe unsized use virtual where while yield AsMut AsRef AsSlice CharExt Clone Copy Debug Decodable Default Display DoubleEndedIterator Drop Encodable Eq ExactSizeIterator Extend Fn FnMut FnOnce From FromPrimitive Hash Into IntoIterator Iterator IteratorExt MutPtrExt Ord PartialEq PartialOrd PtrExt Rand RustcDecodable RustcEncodable Send Sized SliceConcatExt SliceExt Str StrExt Sync ToOwned ToString bool isize usize i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str Option Result Self Box Vec String Path PathBuf c_float c_double c_void FILE fpos_t DIR dirent c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong size_t ptrdiff_t clock_t time_t c_longlong c_ulonglong intptr_t uintptr_t off_t dev_t ino_t pid_t mode_t ssize_t self true false Some None Ok Err Success Failure Cons Nil EXIT_FAILURE EXIT_SUCCESS RAND_MAX EOF SEEK_SET SEEK_CUR SEEK_END _IOFBF _IONBF _IOLBF BUFSIZ FOPEN_MAX FILENAME_MAX L_tmpnam TMP_MAX O_RDONLY O_WRONLY O_RDWR O_APPEND O_CREAT O_EXCL O_TRUNC S_IFIFO S_IFCHR S_IFBLK S_IFDIR S_IFREG S_IFMT S_IEXEC S_IWRITE S_IREAD S_IRWXU S_IXUSR S_IWUSR S_IRUSR F_OK R_OK W_OK X_OK STDIN_FILENO STDOUT_FILENO STDERR_FILENO - + + + + + + diff --git a/data/syntax/yacc.xml b/data/syntax/yacc.xml index 6936c7a..06d6492 100644 --- a/data/syntax/yacc.xml +++ b/data/syntax/yacc.xml @@ -1,264 +1,267 @@ - + + + - - + + +