[geany/geany] e94d16: Merge branch 'SiegeLord/rust_updates'

Colomban Wendling git-noreply at xxxxx
Wed Apr 2 17:56:24 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 02 Apr 2014 17:56:24 UTC
Commit:      e94d162d300adb465bcc7dcd41bc8c584c3eec61
             https://github.com/geany/geany/commit/e94d162d300adb465bcc7dcd41bc8c584c3eec61

Log Message:
-----------
Merge branch 'SiegeLord/rust_updates'


Modified Paths:
--------------
    data/filetypes.rust
    tagmanager/ctags/rust.c
    tests/ctags/test_input.rs
    tests/ctags/test_input.rs.tags
    tests/ctags/test_input2.rs

Modified: data/filetypes.rust
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -22,7 +22,7 @@ lexerror=error
 
 [keywords]
 # all items must be in one line
-primary=alignof as be box break const continue do else enum extern false fn for if impl in let __log_level loop match mod mut offsetof once priv proc pub pure ref return self sizeof static struct super trait true type typeof unsafe unsized use while yield
+primary=alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self sizeof static struct super trait true type typeof unsafe unsized use while yield
 secondary=bool char f32 f64 i16 i32 i64 i8 int str u16 u32 u64 u8 uint
 tertiary=Self
 


Modified: tagmanager/ctags/rust.c
61 files changed, 47 insertions(+), 14 deletions(-)
===================================================================
@@ -67,6 +67,7 @@
 	TOKEN_IDENT,
 	TOKEN_LSHIFT,
 	TOKEN_RSHIFT,
+	TOKEN_RARROW,
 	TOKEN_EOF
 } tokenType;
 
@@ -129,6 +130,9 @@ static void writeCurTokenToStr (lexerState *lexer, vString *out_str)
 		case TOKEN_RSHIFT:
 			vStringCatS(out_str, ">>");
 			break;
+		case TOKEN_RARROW:
+			vStringCatS(out_str, "->");
+			break;
 		default:
 			vStringPut(out_str, (char) lexer->cur_token);
 	}
@@ -356,6 +360,11 @@ static int advanceToken (lexerState *lexer, boolean skip_whitspace)
 			advanceNChar(lexer, 2);
 			return lexer->cur_token = TOKEN_LSHIFT;
 		}
+		else if (lexer->cur_c == '-' && lexer->next_c == '>')
+		{
+			advanceNChar(lexer, 2);
+			return lexer->cur_token = TOKEN_RARROW;
+		}
 		else
 		{
 			int c = lexer->cur_c;
@@ -706,10 +715,31 @@ static void parseStructOrEnum (lexerState *lexer, vString *scope, int parent_kin
 		vString *field_name = vStringNew();
 		while (lexer->cur_token != TOKEN_EOF)
 		{
+			int goal_tokens2[] = {'}', ','};
+			/* Skip attributes. Format:
+			 * #[..] or #![..]
+			 * */
+			if (lexer->cur_token == '#')
+			{
+				advanceToken(lexer, TRUE);
+				if (lexer->cur_token == '!')
+					advanceToken(lexer, TRUE);
+				if (lexer->cur_token == '[')
+				{
+					/* It's an attribute, skip it. */
+					skipUntil(lexer, NULL, 0);
+				}
+				else
+				{
+					/* Something's up with this field, skip to the next one */
+					skipUntil(lexer, goal_tokens2, 2);
+					continue;
+				}
+			}
 			if (lexer->cur_token == TOKEN_IDENT)
 			{
-				int goal_tokens2[] = {'}', ','};
-				if (strcmp(lexer->token_str->buffer, "priv") == 0)
+				if (strcmp(lexer->token_str->buffer, "priv") == 0
+				    || strcmp(lexer->token_str->buffer, "pub") == 0)
 				{
 					advanceToken(lexer, TRUE);
 					if (lexer->cur_token != TOKEN_IDENT)
@@ -746,19 +776,22 @@ static void skipMacro (lexerState *lexer)
 	int minus_token = 0;
 
 	advanceToken(lexer, TRUE);
-	if (lexer->cur_token == '(')
-	{
-		plus_token = '(';
-		minus_token = ')';
-	}
-	else if (lexer->cur_token == '{')
-	{
-		plus_token = '{';
-		minus_token = '}';
-	}
-	else
+	switch (lexer->cur_token)
 	{
-		return;
+		case '(':
+			plus_token = '(';
+			minus_token = ')';
+			break;
+		case '{':
+			plus_token = '{';
+			minus_token = '}';
+			break;
+		case '[':
+			plus_token = '[';
+			minus_token = ']';
+			break;
+		default:
+			return;
 	}
 
 	while (lexer->cur_token != TOKEN_EOF)


Modified: tests/ctags/test_input.rs
29 files changed, 27 insertions(+), 2 deletions(-)
===================================================================
@@ -2,9 +2,23 @@
 #[feature(globs)];
 #[feature(macro_rules)];
 use std::*;
+use std::io::stdio::println;
 use test_input2::*;
 mod test_input2;
 
+pub struct A
+{
+	foo: fn() -> int,
+	bar: int
+}
+
+pub struct B
+{
+	#[cfg(test)]
+	foo: int,
+	bar: int
+}
+
 /*
  * fn ignored_in_comment() {}
  */
@@ -18,8 +32,9 @@ mod test_input2;
 
 static size: uint = 1;
 
+#[cfg(test)]
 struct S1 {
-	only_field: [int, ..size]
+	priv only_field: [int, ..size]
 }
 
 macro_rules! test_macro
@@ -27,6 +42,8 @@ macro_rules! test_macro
 	() => {1}
 }
 
+macro_rules! ignore (($($x:tt)*) => (()))
+
 fn yada(a:int,c:Foo,b:test_input2::fruit::SomeStruct) -> ~str {
 	a.to_str()
 }
@@ -43,6 +60,14 @@ fn main() {
 	(
 		fn ignored_inside_macro() {}
 	)
+	ignore!
+	[
+		fn ignored_inside_macro() {}
+	]
+	ignore!
+	{
+		fn ignored_inside_macro() {}
+	}
 
 	let _ = "fn ignored_in_string() {}
 	";
@@ -64,7 +89,7 @@ struct Foo2 {
 }
 
 impl Foo {
-	fn my_method(&self,_:int){ print("my_method of foo");}
+	fn my_method(&self,_:int){ println("my_method of foo");}
 }
 
 enum Animal {


Modified: tests/ctags/test_input.rs.tags
7 files changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -1,5 +1,7 @@
 # format=tagmanager
+AÌ2048Ö0
 AnimalÌ2Ö0
+BÌ2048Ö0
 BarÌ2048Ö0
 BazÌ2048Ö0
 DoZÌ32Ö0
@@ -16,10 +18,15 @@ a_anteater
 a_bearÌ4ÎAnimalÖ0
 a_catÌ4ÎAnimalÖ0
 a_dogÌ4ÎAnimalÖ0
+barÌ8ÎAÖ0
+barÌ8ÎBÖ0
 do_zÌ128Í(&self)ÎDoZÖ0
 do_zÌ128Í(&self)ÎFooÖ0
+fooÌ8ÎAÖ0
+fooÌ8ÎBÖ0
 foo_field_1Ì8ÎFooÖ0
 gfuncÌ16Í<X:Testable+DoZ>(x:&X)Ö0
+ignoreÌ65536Ö0
 mainÌ16Í()Ö0
 my_methodÌ128Í(&self,_:int)ÎFooÖ0
 nestedÌ16Í()ÎmainÖ0


Modified: tests/ctags/test_input2.rs
6 files changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -1,3 +1,5 @@
+use std::io::stdio::println;
+
 pub fn foo_bar_test_func(apples:fruit::SomeStruct,(oranges,lemon):(int,int))->int{
 	let some_var_name=2*oranges;
 	let a=SomeLongStructName{v:0};
@@ -8,7 +10,9 @@ pub fn foo_bar_test_func(apples:fruit::SomeStruct,(oranges,lemon):(int,int))->in
 
 pub mod fruit {
 	pub struct SomeStruct{
-		red_value:int,green_value:int,blue_value:int
+		pub red_value: int,
+		pub green_value: int,
+		pub blue_value: int
 	}
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list