Changeset 264 for trunk/idl-compiler


Ignore:
Timestamp:
Mar 24, 2007, 7:17:11 PM (18 years ago)
Author:
cinc
Message:

More code...

Location:
trunk/idl-compiler
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/idl-compiler/Makefile

    r260 r264  
    3232                        $(OBJDIR)/classversion_parser.o \
    3333                        $(OBJDIR)/override_parser.o \
     34                        $(OBJDIR)/hash_parser.o \
     35                        $(OBJDIR)/lineinfo_parser.o \
    3436                        $(OBJDIR)/printdata.o
    3537
  • trunk/idl-compiler/c/nom-idl-compiler.c

    r263 r264  
    162162        parseInterface(token);
    163163        break;
     164      case '#':
     165        parseHash();
     166        break;
    164167
    165168#if 0
     
    181184      case ';':
    182185        g_message("Token: %d (semicolon)\t\t\t;", token);
    183         break;
    184       case '#':
    185         g_message("Token: %d (hash)\t\t\t#", token);
    186186        break;
    187187      case '/':
     
    315315  parseIt();
    316316
    317   if(pInterfaceArray->len)
    318     printInterface();
     317  //if(pInterfaceArray->len)
     318  //  printInterface();
    319319
    320320  g_scanner_destroy(gScanner);
  • trunk/idl-compiler/c/token.c

    r259 r264  
    159159    {
    160160    case IDL_SYMBOL_INTERFACE:
    161       g_message("Token: %d (IDL_SYMBOL_INTERFACE)\tParsing...", token);
     161      g_message("Token: %d (IDL_SYMBOL_INTERFACE)\t\t\t (LINE %d)", token, g_scanner_cur_line(gScanner));
    162162      break;
    163163    case G_TOKEN_IDENTIFIER:
    164       g_message("Token: %d (G_TOKEN_IDENTIFIER)\t\t%s", token, value.v_identifier);
     164      g_message("Token: %d (G_TOKEN_IDENTIFIER)\t\t%s (LINE %d)",
     165                token, value.v_identifier, g_scanner_cur_line(gScanner));
    165166      break;
    166167    case G_TOKEN_STRING:
     
    168169      break;
    169170    case G_TOKEN_LEFT_PAREN:
    170       g_message("Token: %d (G_TOKEN_LEFT_PAREN)\t\t(", token);
     171      g_message("Token: %d (G_TOKEN_LEFT_PAREN)\t\t\t( (LINE %d)", token, g_scanner_cur_line(gScanner));
    171172      break;
    172173    case G_TOKEN_RIGHT_PAREN:
    173       g_message("Token: %d (G_TOKEN_RIGHT_PAREN)\t\t)", token);
     174      g_message("Token: %d (G_TOKEN_RIGHT_PAREN)\t\t\t) (LINE %d)", token, g_scanner_cur_line(gScanner));
     175      break;
     176    case G_TOKEN_LEFT_CURLY:
     177      g_message("Token: %d (G_TOKEN_LEFT_CURLY)\t\t\t{ (LINE %d)", token, g_scanner_cur_line(gScanner));
     178      break;
     179    case G_TOKEN_RIGHT_CURLY:
     180      g_message("Token: %d (G_TOKEN_RIGHT_CURLY)\t\t\t} (LINE %d)", token, g_scanner_cur_line(gScanner));
    174181      break;
    175182    case ':':
     
    201208      break;
    202209    default:
    203       g_message("Token: %d (---)\t\t\t (LINE %d)", token, g_scanner_cur_line(gScanner));
    204       break;
    205     }
    206 }
     210      {
     211        PSYMBOLINFO psi;
     212        psi=(PSYMBOLINFO)gScanner->user_data;
     213
     214        if(token>G_TOKEN_LAST)
     215          g_message("Token: %d (%s)\t\t\t (LINE %d)", token,
     216                    psi->pSymbols[token-G_TOKEN_LAST-1].chrSymbolName, g_scanner_cur_line(gScanner));
     217        else
     218          g_message("Token: %d (---)\t\t\t (LINE %d)", token, g_scanner_cur_line(gScanner));
     219        break;
     220      } /* default */
     221    } /* switch */
     222}
  • trunk/idl-compiler/include/parser.h

    r261 r264  
    5151{
    5252  gchar* chrName;    /* Name of this instance variable */
     53  gchar* chrIntroducingIFace;
    5354}OVERMETHOD, *POVERMETHOD;
    5455
     
    100101  const SYMBOL    *pSymbols;     /* List of our introduced symbols */
    101102  guint     uiCurSymbolKind;
     103  guint     uiLineCorrection;    /* This is the line number put by the preprocessor into
     104                                    the source file. It's used to calculate proper line numbers
     105                                    for errors. */
     106  char*     chrCurrentSourceFile;/* The preprocessor includes files for us. This is the info
     107                                    about their name. */
    102108}SYMBOLINFO,*PSYMBOLINFO;
    103109
     
    145151void parseClassVersion(void);
    146152void parseOverrideMethod(void);
     153void parseHash(void);
     154void parsePreprocLineInfo(void);
    147155
    148 
  • trunk/idl-compiler/parser_c/interface_parser.c

    r261 r264  
    3737
    3838#include <glib.h>
     39#include <glib/gprintf.h>
    3940#include "parser.h"
    4041
     
    7172
    7273  do{
    73     //g_printf("%d: ", __LINE__);
    74     //printToken(curToken);
     74    g_printf("%d: ", __LINE__);
     75    printToken(curToken);
    7576    if(matchNext(IDL_SYMBOL_CLSVERSION))
    7677      parseClassVersion();
     
    8586    else
    8687      {
    87         //g_message("Line %d Error in'interface' deklaration %d", g_scanner_cur_line(gScanner),
    88         //        g_scanner_peek_next_token(gScanner));
    89         //g_printf("%d: ", __LINE__);
    90         //printToken(curToken);
    91         /* Unknown token, skip it. */
    9288        getNextToken();
    93         //exit(1);
     89        g_scanner_unexp_token(gScanner,
     90                              G_TOKEN_IDENTIFIER,
     91                              NULL,
     92                              NULL,
     93                              NULL,
     94                              "Trying to parse interface body.",
     95                              TRUE); /* is_error */
     96        exit(1);
    9497      }
    9598    }while(g_scanner_peek_next_token(gScanner)!='}');
  • trunk/idl-compiler/parser_c/method_parser.c

    r263 r264  
    3636
    3737#include <glib.h>
     38#include <glib/gprintf.h>
    3839#include "parser.h"
    3940
     
    150151  PMETHOD pMethod=createMethodStruct();
    151152  PINTERFACE pif;
    152   //g_printf("%d: ", __LINE__);
    153   //printToken(curToken);
     153  g_printf("%s %d: ", __FUNCTION__, __LINE__);
     154  printToken(curToken);
    154155
    155156  /* Do type spec */
  • trunk/idl-compiler/parser_c/override_parser.c

    r262 r264  
    7373  GTokenValue value;
    7474  POVERMETHOD pOMethod=g_malloc0(sizeof(OVERMETHOD));
     75  PINTERFACE pif;
    7576
    7677  if(!matchNext('('))
     
    103104
    104105  /* Now check if the method was introduced by some parent */
    105   if(!findInterfaceForMethod(pCurInterface, pOMethod->chrName))
     106  if((pif=findInterfaceForMethod(pCurInterface, pOMethod->chrName))==NULL)
    106107    {
     108
    107109      g_message("%s:%d: Method '%s' was not introduced by some parent interface.", gScanner->input_name,
    108110                g_scanner_cur_line(gScanner), pOMethod->chrName);
    109111      exit(1);
    110112    }
     113  pOMethod->chrIntroducingIFace=pif->chrName; /* No copy of string here. Nobody should free the
     114                                               interface info under our feet. */
    111115
    112116  if(!matchNext(')'))
Note: See TracChangeset for help on using the changeset viewer.