~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Source/CParse/cscanner.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * C identifiers up into keywords and SWIG directives.
12
12
 * ----------------------------------------------------------------------------- */
13
13
 
14
 
char cvsroot_cscanner_c[] = "$Id: cscanner.c 10511 2008-05-30 16:11:27Z olly $";
 
14
char cvsroot_cscanner_c[] = "$Id: cscanner.c 11123 2009-02-08 22:30:10Z wsfulton $";
15
15
 
16
16
#include "cparse.h"
17
17
#include "parser.h"
22
22
static Scanner *scan = 0;
23
23
 
24
24
/* Global string containing C code. Used by the parser to grab code blocks */
25
 
DOHString *scanner_ccode = 0;
 
25
String *scanner_ccode = 0;
 
26
 
 
27
/* The main file being parsed */
 
28
static String *main_input_file = 0;
26
29
 
27
30
/* Error reporting/location information */
28
31
int     cparse_line = 1;
261
264
  while (1) {
262
265
    if ((tok = Scanner_token(scan)) == 0)
263
266
      return 0;
264
 
    if (tok == SWIG_TOKEN_ERROR) {
265
 
      Swig_error(Scanner_file(scan), Scanner_errline(scan), Scanner_errmsg(scan));
266
 
      continue;
267
 
    }
 
267
    if (tok == SWIG_TOKEN_ERROR)
 
268
      return 0;
268
269
    cparse_start_line = Scanner_start_line(scan);
269
270
    cparse_line = Scanner_line(scan);
270
271
    cparse_file = Scanner_file(scan);
441
442
 
442
443
static int check_typedef = 0;
443
444
 
444
 
void scanner_set_location(String_or_char *file, int line) {
 
445
void scanner_set_location(String *file, int line) {
445
446
  Scanner_set_location(scan,file,line-1);
446
447
}
447
448
 
467
468
  next_token = tok;
468
469
}
469
470
 
 
471
void scanner_set_main_input_file(String *file) {
 
472
  main_input_file = file;
 
473
}
 
474
 
 
475
String *scanner_get_main_input_file() {
 
476
  return main_input_file;
 
477
}
 
478
 
470
479
/* ----------------------------------------------------------------------------
471
480
 * int yylex()
472
481
 *
690
699
                termtoken = SWIG_TOKEN_LPAREN;
691
700
                termvalue = "(";
692
701
                break;
693
 
              } else if (nexttok == SWIG_TOKEN_SEMI) {
 
702
              } else if (nexttok == SWIG_TOKEN_CODEBLOCK) {
 
703
                termtoken = SWIG_TOKEN_CODEBLOCK;
 
704
                termvalue = Char(Scanner_text(scan));
 
705
                break;
 
706
              } else if (nexttok == SWIG_TOKEN_LBRACE) {
 
707
                termtoken = SWIG_TOKEN_LBRACE;
 
708
                termvalue = "{";
 
709
                break;
 
710
              } else if (nexttok == SWIG_TOKEN_SEMI) {
694
711
                termtoken = SWIG_TOKEN_SEMI;
695
712
                termvalue = ";";
696
713
                break;
 
714
              } else if (nexttok == SWIG_TOKEN_STRING) {
 
715
                termtoken = SWIG_TOKEN_STRING;
 
716
                termvalue = Swig_copy_string(Char(Scanner_text(scan)));
 
717
                break;
697
718
              } else if (nexttok == SWIG_TOKEN_ID) {
698
719
                if (needspace) {
699
720
                  Append(s," ");
859
880
        return (INLINE);
860
881
      if (strcmp(yytext, "%typemap") == 0)
861
882
        return (TYPEMAP);
862
 
      if (strcmp(yytext, "%feature") == 0)
 
883
      if (strcmp(yytext, "%feature") == 0) {
 
884
        /* The rename_active indicates we don't need the information of the 
 
885
         * following function's return type. This applied for %rename, so do
 
886
         * %feature. 
 
887
         */
 
888
        rename_active = 1;
863
889
        return (FEATURE);
 
890
      }
864
891
      if (strcmp(yytext, "%except") == 0)
865
892
        return (EXCEPT);
866
893
      if (strcmp(yytext, "%importfile") == 0)