[anjuta] am-project: Fix some issues when loading rhythmbox
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: Fix some issues when loading rhythmbox
- Date: Thu, 17 Feb 2011 21:24:31 +0000 (UTC)
commit 2649f383c434cd4211a330451f49930d11e4d522
Author: Sébastien Granjoux <seb sfo free fr>
Date: Thu Feb 17 22:05:47 2011 +0100
am-project: Fix some issues when loading rhythmbox
libanjuta/anjuta-token-stream.c | 27 ++++++++++++++++++++++++---
libanjuta/anjuta-token-stream.h | 1 +
plugins/am-project/ac-scanner.l | 2 ++
plugins/am-project/am-scanner.l | 2 ++
4 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/libanjuta/anjuta-token-stream.c b/libanjuta/anjuta-token-stream.c
index 3bef95e..577a863 100644
--- a/libanjuta/anjuta-token-stream.c
+++ b/libanjuta/anjuta-token-stream.c
@@ -79,6 +79,9 @@ struct _AnjutaTokenStream
/* Current directory */
GFile *current_directory;
+
+ /* Current file */
+ GFile *current_file;
};
/* Helpers functions
@@ -280,6 +283,21 @@ anjuta_token_stream_get_current_directory (AnjutaTokenStream *stream)
}
+/**
+ * anjuta_token_stream_get_current_file:
+ * @stream: a #AnjutaTokenStream object.
+ *
+ * Return the current file.
+ *
+ * Return value: The current file.
+ */
+GFile*
+anjuta_token_stream_get_current_file (AnjutaTokenStream *stream)
+{
+ g_return_val_if_fail (stream != NULL, NULL);
+
+ return stream->current_file;
+}
/* Constructor & Destructor
*---------------------------------------------------------------------------*/
@@ -297,7 +315,7 @@ anjuta_token_stream_get_current_directory (AnjutaTokenStream *stream)
* Return value: The newly created stream.
*/
AnjutaTokenStream *
-anjuta_token_stream_push (AnjutaTokenStream *parent, AnjutaToken *root, AnjutaToken *content, GFile *filename)
+anjuta_token_stream_push (AnjutaTokenStream *parent, AnjutaToken *root, AnjutaToken *content, GFile *file)
{
AnjutaTokenStream *child;
@@ -313,13 +331,15 @@ anjuta_token_stream_push (AnjutaTokenStream *parent, AnjutaToken *root, AnjutaTo
if (child->last == content) child->last = NULL;
child->root = root == NULL ? anjuta_token_new_static (ANJUTA_TOKEN_FILE, NULL) : root;
- if (filename == NULL)
+ if (file == NULL)
{
child->current_directory = parent == NULL ? NULL : (parent->current_directory == NULL ? NULL : g_object_ref (parent->current_directory));
+ child->current_file = NULL;
}
else
{
- child->current_directory = g_file_get_parent (filename);
+ child->current_directory = g_file_get_parent (file);
+ child->current_file = g_object_ref (file);
}
return child;
@@ -341,6 +361,7 @@ anjuta_token_stream_pop (AnjutaTokenStream *stream)
g_return_val_if_fail (stream != NULL, NULL);
if (stream->current_directory) g_object_unref (stream->current_directory);
+ if (stream->current_file) g_object_unref (stream->current_file);
parent = stream->parent;
g_free (stream);
diff --git a/libanjuta/anjuta-token-stream.h b/libanjuta/anjuta-token-stream.h
index 170b34f..bfeb38f 100644
--- a/libanjuta/anjuta-token-stream.h
+++ b/libanjuta/anjuta-token-stream.h
@@ -33,6 +33,7 @@ AnjutaTokenStream *anjuta_token_stream_pop (AnjutaTokenStream *stream);
AnjutaToken* anjuta_token_stream_get_root (AnjutaTokenStream *stream);
GFile* anjuta_token_stream_get_current_directory (AnjutaTokenStream *stream);
+GFile* anjuta_token_stream_get_current_file (AnjutaTokenStream *stream);
AnjutaToken* anjuta_token_stream_tokenize (AnjutaTokenStream *stream, gint type, gsize length);
gint anjuta_token_stream_read (AnjutaTokenStream *stream, gchar *buffer, gsize max_size);
diff --git a/plugins/am-project/ac-scanner.l b/plugins/am-project/ac-scanner.l
index 162cbc6..a88e8fd 100644
--- a/plugins/am-project/ac-scanner.l
+++ b/plugins/am-project/ac-scanner.l
@@ -204,6 +204,8 @@ PKG_PROG_PKG_CONFIG\( { RETURN (PKG_PROG_PKG_CONFIG);}
{WSNL} { RETURN (SPACE); }
+\\\n { RETURN (SPACE); }
+
=|<|>|<=|>= { RETURN (OPERATOR); }
{NAME} { RETURN (WORD); }
diff --git a/plugins/am-project/am-scanner.l b/plugins/am-project/am-scanner.l
index 280be8b..678bba7 100644
--- a/plugins/am-project/am-scanner.l
+++ b/plugins/am-project/am-scanner.l
@@ -232,6 +232,8 @@ amp_am_scanner_parse_end (AmpAmScanner *scanner)
}
else
{
+ scanner->eof = anjuta_token_stream_get_current_file (scanner->stream) != NULL;
+
/* Continue parsing the parent file */
return 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]