~ubuntu-branches/ubuntu/wily/aspectc++/wily

« back to all changes in this revision

Viewing changes to Puma/src/common/Token.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-06-15 10:17:02 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090615101702-qsr30iptwbxylmo2
Tags: 1.0pre4~svn.20090615-1
* New upstream release.
* don't ignore errors in the postrm script
* avoid spurious creation of empty dir ./usr/sbin/
* improve short descriptions of libpuma-doc and libpuma-dev
* bump Standards-Version to 3.8.1
* bump debhelper compat level to level 7 (latest in stable)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "Puma/Chain.h"
27
27
#include "Puma/StrCol.h"
28
28
#include "Puma/ConstSizeMemPool.h"
 
29
#include "Puma/Unit.h"
29
30
#include <string.h>
30
31
#include <stdlib.h>
31
32
#include <assert.h>
138
139
    case TOK_WCHAR_T_2: return TOK_WCHAR_T;
139
140
    case TOK_TYPEOF_2: return TOK_TYPEOF;
140
141
    case TOK_TYPEOF_3: return TOK_TYPEOF;
 
142
    case TOK_ALIGNOF_2: return TOK_ALIGNOF;
 
143
    case TOK_ALIGNOF_3: return TOK_ALIGNOF;
141
144
    case TOK_CDECL_2: return TOK_CDECL;
142
145
    case TOK_STDCALL_2: return TOK_STDCALL;
143
146
    case TOK_FASTCALL_2: return TOK_FASTCALL;
165
168
}
166
169
 
167
170
 
168
 
char *Token::get_static_text () const { 
 
171
char *Token::get_static_text () const {
169
172
  if (!(is_core () || is_wildcard ()) ||
170
173
      (is_identifier () && !is_keyword ()))
171
174
    return 0;
172
 
 
173
 
  switch (_real_type) {
 
175
  return get_static_text (_real_type);
 
176
}
 
177
 
 
178
 
 
179
char *Token::get_static_text (int token_type) {
 
180
  switch (token_type) {
174
181
    case TOK_COMMA: return (char*)",";
175
182
    case TOK_ASSIGN: return (char*)"=";
176
183
    case TOK_AT: return (char*)"@";
245
252
    case TOK_SHORT: return (char*)"short";
246
253
    case TOK_SIZEOF: return (char*)"sizeof";
247
254
    case TOK_STATIC: return (char*)"static";
 
255
    case TOK_THREAD: return (char*)"__thread";
248
256
    case TOK_STRUCT: return (char*)"struct";
249
257
    case TOK_SWITCH: return (char*)"switch";
250
258
    case TOK_TYPEDEF: return (char*)"typedef";
341
349
    case TOK_ANY_MEM_INIT: return (char*)"\\any-mem-initializer";
342
350
    case TOK_ANY_STMT: return (char*)"\\any-statement";
343
351
    case TOK_ANY_STMT_SEQ: return (char*)"\\any-statement-seq";
344
 
    case TOK_IS_TYPEDEF: return (char*)"\\is-typedef";
345
 
    case TOK_IS_CLASS: return (char*)"\\is-class";
346
 
    case TOK_IS_ENUM: return (char*)"\\is-enum";
 
352
    case TOK_WC_IS_TYPEDEF: return (char*)"\\is-typedef";
 
353
    case TOK_WC_IS_CLASS: return (char*)"\\is-class";
 
354
    case TOK_WC_IS_ENUM: return (char*)"\\is-enum";
347
355
    case TOK_MO_HASH: return (char*)"#";
348
356
    case TOK_MO_HASHHASH: return (char*)"##";
349
357
    case ID_END_OF_FILE:
350
358
    case ID_ERROR:
351
359
    case ID_UNKNOWN:
352
 
    case ID_WARNING:
353
 
      return (char*)"";
 
360
    case ID_WARNING: return (char*)"";
354
361
    case TOK_AND_AND_ISO_646: return (char*)"and";
355
362
    case TOK_AND_EQ_ISO_646: return (char*)"and_eq";
356
363
    case TOK_AND_ISO_646: return (char*)"bitand";
387
394
    case TOK_TYPEOF: return (char*)"typeof";
388
395
    case TOK_TYPEOF_2: return (char*)"__typeof";
389
396
    case TOK_TYPEOF_3: return (char*)"__typeof__";
 
397
    case TOK_ALIGNOF:
 
398
    case TOK_ALIGNOF_2: return (char*)"__alignof";
 
399
    case TOK_ALIGNOF_3: return (char*)"__alignof__";
390
400
    case TOK_CDECL: return (char*)"_cdecl";
391
401
    case TOK_CDECL_2: return (char*)"__cdecl";
392
402
    case TOK_STDCALL: return (char*)"_stdcall";
395
405
    case TOK_FASTCALL_2: return (char*)"__fastcall";
396
406
    case TOK_IF_EXISTS: return (char*)"__if_exists";
397
407
    case TOK_IF_NOT_EXISTS: return (char*)"__if_not_exists";
 
408
    case TOK_HAS_NOTHROW_ASSIGN: return (char*)"__has_nothrow_assign";
 
409
    case TOK_HAS_NOTHROW_COPY: return (char*)"__has_nothrow_copy";
 
410
    case TOK_HAS_NOTHROW_CTOR: return (char*)"__has_nothrow_constructor";
 
411
    case TOK_HAS_TRIVIAL_ASSIGN: return (char*)"__has_trivial_assign";
 
412
    case TOK_HAS_TRIVIAL_COPY: return (char*)"__has_trivial_copy";
 
413
    case TOK_HAS_TRIVIAL_CTOR: return (char*)"__has_trivial_constructor";
 
414
    case TOK_HAS_TRIVIAL_DTOR: return (char*)"__has_trivial_destructor";
 
415
    case TOK_HAS_VIRTUAL_DTOR: return (char*)"__has_virtual_destructor";
 
416
    case TOK_IS_ABSTRACT: return (char*)"__is_abstract";
 
417
    case TOK_IS_BASE_OF: return (char*)"__is_base_of";
 
418
    case TOK_IS_CLASS: return (char*)"__is_class";
 
419
    case TOK_IS_EMPTY: return (char*)"__is_empty";
 
420
    case TOK_IS_ENUM: return (char*)"__is_enum";
 
421
    case TOK_IS_POD: return (char*)"__is_pod";
 
422
    case TOK_IS_POLYMORPHIC: return (char*)"__is_polymorphic";
 
423
    case TOK_IS_UNION: return (char*)"__is_union";
398
424
//    case TOK_EXPR_QUESTION: return (char*)"?";
399
425
//    case TOK_EXPR_BITOR: return (char*)"|";
400
426
//    case TOK_EXPR_BITXOR: return (char*)"^";
419
445
//    case TOK_EXPR_GEQ: return (char*)">=";
420
446
//    case TOK_EXPR_SHIFTL: return (char*)"<<";
421
447
//    case TOK_EXPR_SHIFTR: return (char*)">>";
422
 
    default:
423
 
      return 0;
 
448
    default: return 0;
424
449
  }
425
450
}
426
451
 
462
487
  return result;
463
488
}
464
489
 
 
490
Unit* Token::unit () const {
 
491
  return (Unit*)belonging_to();
 
492
}
 
493
 
465
494
} // namespace Puma