summaryrefslogtreecommitdiff
path: root/giscanner/scannerlexer.l
diff options
context:
space:
mode:
authorColin Walters <walters@src.gnome.org>2008-09-15 14:46:19 +0000
committerColin Walters <walters@src.gnome.org>2008-09-15 14:46:19 +0000
commitfc363396107d56175766223446c38757db3f97c9 (patch)
treea37ed1e5dd9523e380d7af62281a9a9dc1e55725 /giscanner/scannerlexer.l
parent6220930672de3cdb13343317109637cb3f8ffedf (diff)
downloadgobject-introspection-fc363396107d56175766223446c38757db3f97c9.tar.gz
Bug 552065: Add deprecation information to GIR
* giscanner/ast.py: Add deprecation attributes. * giscanner/girwriter.py: Write out deprecation data. * girepository/girparser.c: Relax parsing; deprecated attribute now includes freeform string. * giscanner/scannerlexer.l: Parse Deprecated. * giscanner/transformer.py: Look for deprecated attribute on functions. * tests/scanner/*: Add a Deprecated test. svn path=/trunk/; revision=603
Diffstat (limited to 'giscanner/scannerlexer.l')
-rw-r--r--giscanner/scannerlexer.l26
1 files changed, 20 insertions, 6 deletions
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l
index 0f41637c..98e7c35a 100644
--- a/giscanner/scannerlexer.l
+++ b/giscanner/scannerlexer.l
@@ -207,6 +207,7 @@ parse_gtkdoc (GISourceScanner *scanner,
GSList *directives;
GSList *options = NULL;
char *rname;
+ int n_parts;
i = 0;
do
@@ -229,12 +230,24 @@ parse_gtkdoc (GISourceScanner *scanner,
line[i] = '\0';
parts = g_strsplit (line, ": ", 3);
+ n_parts = g_strv_length (parts);
- if (g_strv_length (parts) >= 2)
+ if (g_ascii_strcasecmp (parts[0], "eprecated") == 0)
+ {
+ if (n_parts == 3)
+ options = g_slist_prepend (options, g_strdup (parts[2]));
+ else if (n_parts == 2)
+ options = g_slist_prepend (options, g_strdup (parts[1]));
+ else
+ options = g_slist_prepend (options, g_strdup (""));
+ name = parts[0];
+ value = NULL;
+ }
+ else if (n_parts >= 2)
{
name = parts[0];
- if (g_strv_length (parts) == 3)
+ if (n_parts == 3)
{
char *ptr = parts[1];
GString *current = NULL;
@@ -275,12 +288,13 @@ parse_gtkdoc (GISourceScanner *scanner,
}
/*
- * This is a special case for return values, name will only be
- * 'eturn' or a valid name, check the call site.
- * Context-sensitive parsing would probably be the right way to go
+ * Special cases for global annotations.
+ * Context-sensitive parsing would probably be the right way to go.
*/
if (g_ascii_strncasecmp ("eturn", name, 5) == 0)
rname = "return";
+ else if (g_ascii_strncasecmp ("eprecated", name, 9) == 0)
+ rname = "deprecated";
else
rname = name;
@@ -333,7 +347,7 @@ parse_comment (GISourceScanner *scanner)
if ((c1 != '*' && c1 != ' '))
startofline = FALSE;
- if (startofline && (c1 == ' ') && (c2 == '@' || (c2 == 'r') || (c2 == 'R')))
+ if (startofline && (c1 == ' ') && (c2 == '@' || (c2 == 'r') || (c2 == 'R') || (c2 == 'D')))
{
c1 = c2;
c2 = input();