Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: SiegeLord <slabode(a)aim.com>
Date: Tue, 14 Jan 2014 17:50:37 UTC
Commit: ad59468f3e4efb8e49503a1e5e687196f5013ede
https://github.com/geany/geany/commit/ad59468f3e4efb8e49503a1e5e687196f5013…
Log Message:
-----------
rust: Don't use fileEOF() as it behaves unexpectedly
fileEOF() actually returns TRUE anywhere after the last newline when
using the file*() API, which includes a last line without newline.
This is an implementation detail which makes this function not usable
with the rest of the file*() API. fileEOF() should actually probably
be called iFileEOF(), but that's outside the scope of this parser.
However, even if fileEOF() did work properly with fileGetc(), the very
last byte in the input would have been omitted because we actually
read ahead by one byte, which means the actual read reaches EOF one
byte before our "current byte" does.
Checking whether we reached EOF by checking whether our current byte
isn't equal to `EOF` fixes it, and isn't worse since it's actually how
fileEOF() is implemented anyway.
Modified Paths:
--------------
tagmanager/ctags/rust.c
Modified: tagmanager/ctags/rust.c
20 files changed, 10 insertions(+), 10 deletions(-)
===================================================================
@@ -173,7 +173,7 @@ static boolean isIdentifierContinue (int c)
static void scanWhitespace (lexerState *lexer)
{
- while (!fileEOF() && isWhitespace(lexer->cur_c))
+ while (isWhitespace(lexer->cur_c))
advanceChar(lexer);
}
@@ -188,14 +188,14 @@ static void scanComments (lexerState *lexer)
if (lexer->next_c == '/' || lexer->next_c == '!')
{
advanceNChar(lexer, 2);
- while (!fileEOF() && lexer->cur_c != '\n')
+ while (lexer->cur_c != EOF && lexer->cur_c != '\n')
advanceChar(lexer);
}
else if (lexer->next_c == '*')
{
int level = 1;
advanceNChar(lexer, 2);
- while (!fileEOF() && level > 0)
+ while (lexer->cur_c != EOF && level > 0)
{
if (lexer->cur_c == '*' && lexer->next_c == '/')
{
@@ -222,7 +222,7 @@ static void scanIdentifier (lexerState *lexer)
{
vStringPut(lexer->token_str, (char) lexer->cur_c);
advanceChar(lexer);
- } while(!fileEOF() && isIdentifierContinue(lexer->cur_c));
+ } while(lexer->cur_c != EOF && isIdentifierContinue(lexer->cur_c));
}
/* Double-quoted strings, we only care about the \" escape. These
@@ -234,7 +234,7 @@ static void scanString (lexerState *lexer)
{
vStringClear(lexer->token_str);
advanceChar(lexer);
- while (!fileEOF() && lexer->cur_c != '"')
+ while (lexer->cur_c != EOF && lexer->cur_c != '"')
{
if (lexer->cur_c == '\\' && lexer->next_c == '"')
advanceChar(lexer);
@@ -253,7 +253,7 @@ static void scanRawString (lexerState *lexer)
vStringClear(lexer->token_str);
advanceChar(lexer);
/* Count how many leading hashes there are */
- while (!fileEOF() && lexer->cur_c == '#')
+ while (lexer->cur_c == '#')
{
num_initial_hashes++;
advanceChar(lexer);
@@ -261,7 +261,7 @@ static void scanRawString (lexerState *lexer)
if (lexer->cur_c != '"')
return;
advanceChar(lexer);
- while (!fileEOF())
+ while (lexer->cur_c != EOF)
{
if (vStringLength(lexer->token_str) < MAX_STRING_LENGTH)
vStringPut(lexer->token_str, (char) lexer->cur_c);
@@ -271,7 +271,7 @@ static void scanRawString (lexerState *lexer)
{
size_t num_trailing_hashes = 0;
advanceChar(lexer);
- while (!fileEOF() && lexer->cur_c == '#' && num_trailing_hashes < num_initial_hashes)
+ while (lexer->cur_c == '#' && num_trailing_hashes < num_initial_hashes)
{
num_trailing_hashes++;
@@ -306,7 +306,7 @@ static int advanceToken (lexerState *lexer, boolean skip_whitspace)
boolean have_whitespace = FALSE;
lexer->line = getSourceLineNumber();
lexer->pos = getInputFilePosition();
- while (!fileEOF())
+ while (lexer->cur_c != EOF)
{
if (isWhitespace(lexer->cur_c))
{
@@ -327,7 +327,7 @@ static int advanceToken (lexerState *lexer, boolean skip_whitspace)
}
lexer->line = getSourceLineNumber();
lexer->pos = getInputFilePosition();
- while (!fileEOF())
+ while (lexer->cur_c != EOF)
{
if (lexer->cur_c == '"')
{
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: SiegeLord <slabode(a)aim.com>
Committer: SiegeLord <slabode(a)aim.com>
Date: Tue, 14 Jan 2014 17:50:37 UTC
Commit: a08557321296e9fa63dae7b25a2bf71a31a92b39
https://github.com/geany/geany/commit/a08557321296e9fa63dae7b25a2bf71a31a92…
Log Message:
-----------
Use :: as the context separator for Rust
Modified Paths:
--------------
src/symbols.c
Modified: src/symbols.c
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -300,6 +300,7 @@ const gchar *symbols_get_context_separator(gint ft_id)
case GEANY_FILETYPES_GLSL: /* for structs */
/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
case GEANY_FILETYPES_PHP:
+ case GEANY_FILETYPES_RUST:
return "::";
/* avoid confusion with other possible separators in group/section name */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: dobkeratops <dobkeratopsgit(a)gmail.com>
Committer: SiegeLord <slabode(a)aim.com>
Date: Tue, 14 Jan 2014 17:50:37 UTC
Commit: b17b4be1260e8828f62c56c87cf8bf886cbbf3b4
https://github.com/geany/geany/commit/b17b4be1260e8828f62c56c87cf8bf886cbbf…
Log Message:
-----------
Added the Rust filetype
Modified Paths:
--------------
data/filetypes.rust
src/filetypes.c
src/filetypes.h
Modified: data/filetypes.rust
51 files changed, 51 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,51 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling=C]
+
+[keywords]
+# all items must be in one line
+primary=fn type as break const copy do else enum extern fail for if impl let log loop match mod mut priv pub ref return static struct trait unsafe use while in continue alignof be offsetof pure sizeof typeof yield
+secondary=bool int uint i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str Self self
+
+[lexer_properties]
+styling.within.preprocessor=1
+lexer.cpp.track.preprocessor=0
+
+[settings]
+lexer_filetype=C
+
+# default extension used when saving files
+extension=rs
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# single comments, like # in this file
+comment_single=//
+# multiline comments
+comment_open=/*
+comment_close=*/
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+ #command_example();
+# setting to false would generate this
+# command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
+[build_settings]
+# %f will be replaced by the complete filename
+# %e will be replaced by the filename without extension
+# (use only one of it at one time)
+compiler=rustc "%f"
+linker=rustc -o "%e" "%f"
+run_cmd="./%e"
+
Modified: src/filetypes.c
9 files changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -522,6 +522,15 @@ static void init_builtin_filetypes(void)
ft->name = g_strdup("PowerShell");
filetype_make_title(ft, TITLE_SOURCE_FILE);
ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
+
+#define RUST
+ ft = filetypes[GEANY_FILETYPES_RUST];
+ ft->lang = 45;
+ ft->name = g_strdup("Rust");
+ filetype_make_title(ft, TITLE_SOURCE_FILE);
+ ft->mime_type = g_strdup("text/x-rustsrc");
+ ft->group = GEANY_FILETYPE_GROUP_COMPILED;
+
}
Modified: src/filetypes.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -94,6 +94,7 @@
GEANY_FILETYPES_ABAQUS,
GEANY_FILETYPES_BATCH,
GEANY_FILETYPES_POWERSHELL,
+ GEANY_FILETYPES_RUST,
/* ^ append items here */
GEANY_MAX_BUILT_IN_FILETYPES /* Don't use this, use filetypes_array->len instead */
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).