Commit 298b24a4 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

use yyleng instead of strlen don't write unnecessary attributes to reduce

2007-04-06  Jürg Billeter  <j@bitron.ch>

	* vala/scanner.l: use yyleng instead of strlen
	* vala/valainterfacewriter.vala: don't write unnecessary attributes to
	  reduce parse time
	* vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala:
	  remove unnecessary attributes to reduce parse time

svn path=/trunk/; revision=282
parent cb55d7ec
2007-04-06 Jürg Billeter <j@bitron.ch>
* vala/scanner.l: use yyleng instead of strlen
* vala/valainterfacewriter.vala: don't write unnecessary attributes to
reduce parse time
* vapi/atk.vala, vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala:
remove unnecessary attributes to reduce parse time
2007-04-05 Jürg Billeter <j@bitron.ch>
* vala/valacodegenerator.vala, vala/valaforstatement.vala: support
......
/* scanner.l
*
* Copyright (C) 2006 Jürg Billeter, Raffaele Sandrini
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -27,7 +27,7 @@
#define YY_DECL int yylex (YYSTYPE *yylval_param, YYLTYPE *yylloc_param, ValaParser *parser)
#define uploc { yylloc->first_column = yylloc->last_column + 1; yylloc->last_column += strlen (yytext); }
#define uploc { yylloc->first_column = yylloc->last_column + 1; yylloc->last_column += yyleng; }
static gboolean file_comment = FALSE;
%}
......@@ -64,7 +64,7 @@ literal ({integer_literal}|{real_literal}|{character_literal}|{string_literal
%%
"/*" { uploc; file_comment = (yylineno == 1); BEGIN (IN_COMMENT); }
<IN_COMMENT>"*/" { uploc; BEGIN (INITIAL); yytext[strlen (yytext) - 2] = '\0'; vala_parser_push_comment (parser, yytext, file_comment); }
<IN_COMMENT>"*/" { uploc; BEGIN (INITIAL); yytext[yyleng - 2] = '\0'; vala_parser_push_comment (parser, yytext, file_comment); }
<IN_COMMENT>[^*\n]+ { uploc; yymore (); }
<IN_COMMENT>"*" { uploc; yymore (); }
<IN_COMMENT>\n { yylloc->first_line = yylloc->last_line = yylineno; yylloc->first_column = 1; yylloc->last_column = 0; yymore (); }
......
......@@ -374,8 +374,17 @@ public class Vala.InterfaceWriter : CodeVisitor {
}
if (m.no_array_length) {
write_indent ();
write_string ("[NoArrayLength]");
bool array_found = (m.return_type != null && m.return_type.data_type is Array);
foreach (FormalParameter param in m.get_parameters ()) {
if (param.type_reference != null && param.type_reference.data_type is Array) {
array_found = true;
break;
}
}
if (array_found) {
write_indent ();
write_string ("[NoArrayLength]");
}
}
if (m.instance_last) {
write_indent ();
......@@ -385,8 +394,10 @@ public class Vala.InterfaceWriter : CodeVisitor {
write_indent ();
write_string ("[InstanceByReference]");
}
write_indent ();
write_string ("[CCode (cname = \"%s\")]".printf (m.get_cname ()));
if (m.get_cname () != m.get_default_cname ()) {
write_indent ();
write_string ("[CCode (cname = \"%s\")]".printf (m.get_cname ()));
}
write_indent ();
write_string ("public");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment