Changeset 17372 in webkit for trunk/JavaScriptCore/kjs/lexer.cpp


Ignore:
Timestamp:
Oct 27, 2006, 9:48:28 AM (19 years ago)
Author:
darin
Message:

Reviewed by Geoff.

  • made changes so the code compiles with the highest warning level under MSVC (disabling some warnings, making some code fixes)
  • API/JSCallbackConstructor.cpp: (KJS::JSCallbackConstructor::construct):
  • API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::callAsFunction):
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::init): (KJS::JSCallbackObject::construct): (KJS::JSCallbackObject::callAsFunction):
  • API/JSObjectRef.cpp: (JSPropertyNameArrayGetNameAtIndex):
  • API/JSStringRef.cpp: (JSStringCreateWithCharacters):
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): (KJS::Bindings::coerceValueToNPVariantStringType): (KJS::Bindings::convertValueToNPVariant):
  • kjs/DateMath.h: (KJS::GregorianDateTime::GregorianDateTime):
  • kjs/ExecState.h: (KJS::ExecState::hadException):
  • kjs/JSImmediate.h: (KJS::JSImmediate::fromDouble): (KJS::JSImmediate::toDouble): (KJS::JSImmediate::NanAsBits): (KJS::JSImmediate::oneAsBits):
  • kjs/Parser.h:
  • kjs/PropertyNameArray.h: (KJS::PropertyNameArray::size):
  • kjs/array_object.cpp: (ArrayObjectImp::callAsFunction):
  • kjs/bool_object.cpp: (BooleanObjectImp::callAsFunction):
  • kjs/collector.cpp: (KJS::Collector::allocate): (KJS::Collector::markCurrentThreadConservatively): (KJS::Collector::collect):
  • kjs/completion.h: (KJS::Completion::isValueCompletion):
  • kjs/date_object.cpp: (KJS::findMonth):
  • kjs/debugger.cpp: (Debugger::sourceParsed): (Debugger::sourceUnused): (Debugger::exception): (Debugger::atStatement): (Debugger::callEvent): (Debugger::returnEvent):
  • kjs/dtoa.cpp:
  • kjs/error_object.cpp: (ErrorObjectImp::callAsFunction): (NativeErrorImp::callAsFunction):
  • kjs/function.cpp: (KJS::FunctionImp::processVarDecls): (KJS::GlobalFuncImp::callAsFunction):
  • kjs/function_object.cpp: (FunctionPrototype::callAsFunction):
  • kjs/grammar.y:
  • kjs/identifier.cpp: (KJS::CStringTranslator::translate): (KJS::Identifier::add):
  • kjs/internal.h:
  • kjs/lexer.cpp: (Lexer::lex): (Lexer::isIdentStart): (Lexer::isIdentPart): (isDecimalDigit): (Lexer::isHexDigit): (Lexer::isOctalDigit): (Lexer::matchPunctuator): (Lexer::singleEscape): (Lexer::convertOctal): (Lexer::convertHex): (Lexer::convertUnicode): (Lexer::record8):
  • kjs/lexer.h:
  • kjs/math_object.cpp: (MathFuncImp::callAsFunction):
  • kjs/number_object.cpp: (integer_part_noexp): (intPow10): (NumberProtoFunc::callAsFunction): (NumberObjectImp::callAsFunction):
  • kjs/object.cpp: (KJS::JSObject::deleteProperty): (KJS::JSObject::callAsFunction): (KJS::JSObject::toBoolean): (KJS::JSObject::toObject):
  • kjs/object.h: (KJS::JSObject::getPropertySlot):
  • kjs/property_map.cpp: (KJS::isValid): (KJS::PropertyMap::put): (KJS::PropertyMap::insert): (KJS::PropertyMap::containsGettersOrSetters):
  • kjs/property_map.h: (KJS::PropertyMap::hasGetterSetterProperties):
  • kjs/property_slot.h:
  • kjs/string_object.cpp: (StringInstance::getPropertyNames): (StringObjectImp::callAsFunction): (StringObjectFuncImp::callAsFunction):
  • kjs/ustring.cpp: (KJS::UString::Rep::computeHash): (KJS::UString::UString): (KJS::UString::from): (KJS::UString::append): (KJS::UString::ascii): (KJS::UString::operator=): (KJS::UString::find): (KJS::UString::rfind):
  • kjs/ustring.h: (KJS::UChar::high): (KJS::UChar::low): (KJS::UCharReference::low): (KJS::UCharReference::high):
  • kjs/value.cpp: (KJS::JSValue::toUInt16):
  • kjs/value.h:
  • pcre/pcre_compile.c: (get_othercase_range):
  • pcre/pcre_exec.c: (match):
  • pcre/pcre_internal.h:
  • wtf/HashFunctions.h: (WTF::intHash): (WTF::PtrHash::hash):
  • wtf/MathExtras.h: (isnan): (lround): (lroundf):
  • wtf/StringExtras.h: (strncasecmp):
  • wtf/unicode/icu/UnicodeIcu.h: (WTF::Unicode::isPrintableChar):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/lexer.cpp

    r17354 r17372  
    33 *  This file is part of the KDE libraries
    44 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
     5 *  Copyright (C) 2006 Apple Computer, Inc.
    56 *
    67 *  This library is free software; you can redistribute it and/or
     
    3132#include <wtf/unicode/Unicode.h>
    3233
    33 static bool isDecimalDigit(unsigned short c);
     34static bool isDecimalDigit(int);
    3435
    3536// we can't specify the namespace in yacc's C output, so do it here
     
    208209      } else if (current == '"' || current == '\'') {
    209210        state = InString;
    210         stringType = current;
     211        stringType = static_cast<unsigned short>(current);
    211212      } else if (isIdentStart(current)) {
    212213        record16(current);
     
    282283        state = InString;
    283284      } else {
    284         record16(singleEscape(current));
     285        record16(singleEscape(static_cast<unsigned short>(current)));
    285286        state = InString;
    286287      }
     
    581582}
    582583
    583 bool Lexer::isIdentStart(unsigned short c)
     584bool Lexer::isIdentStart(int c)
    584585{
    585586  return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
     
    591592}
    592593
    593 bool Lexer::isIdentPart(unsigned short c)
     594bool Lexer::isIdentPart(int c)
    594595{
    595596  return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
     
    605606}
    606607
    607 static bool isDecimalDigit(unsigned short c)
     608static bool isDecimalDigit(int c)
    608609{
    609610  return (c >= '0' && c <= '9');
    610611}
    611612
    612 bool Lexer::isHexDigit(unsigned short c)
     613bool Lexer::isHexDigit(int c)
    613614{
    614615  return (c >= '0' && c <= '9' ||
     
    617618}
    618619
    619 bool Lexer::isOctalDigit(unsigned short c) const
     620bool Lexer::isOctalDigit(int c)
    620621{
    621622  return (c >= '0' && c <= '7');
    622623}
    623624
    624 int Lexer::matchPunctuator(unsigned short c1, unsigned short c2,
    625                               unsigned short c3, unsigned short c4)
     625int Lexer::matchPunctuator(int c1, int c2, int c3, int c4)
    626626{
    627627  if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
     
    737737}
    738738
    739 unsigned short Lexer::singleEscape(unsigned short c) const
     739unsigned short Lexer::singleEscape(unsigned short c)
    740740{
    741741  switch(c) {
     
    763763}
    764764
    765 unsigned short Lexer::convertOctal(unsigned short c1, unsigned short c2,
    766                                       unsigned short c3) const
    767 {
    768   return ((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0');
    769 }
    770 
    771 unsigned char Lexer::convertHex(unsigned short c)
     765unsigned short Lexer::convertOctal(int c1, int c2, int c3)
     766{
     767  return static_cast<unsigned short>((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0');
     768}
     769
     770unsigned char Lexer::convertHex(int c)
    772771{
    773772  if (c >= '0' && c <= '9')
    774     return (c - '0');
    775   else if (c >= 'a' && c <= 'f')
    776     return (c - 'a' + 10);
    777   else
    778     return (c - 'A' + 10);
    779 }
    780 
    781 unsigned char Lexer::convertHex(unsigned short c1, unsigned short c2)
     773    return static_cast<unsigned char>(c - '0');
     774  if (c >= 'a' && c <= 'f')
     775    return static_cast<unsigned char>(c - 'a' + 10);
     776  return static_cast<unsigned char>(c - 'A' + 10);
     777}
     778
     779unsigned char Lexer::convertHex(int c1, int c2)
    782780{
    783781  return ((convertHex(c1) << 4) + convertHex(c2));
    784782}
    785783
    786 KJS::UChar Lexer::convertUnicode(unsigned short c1, unsigned short c2,
    787                                      unsigned short c3, unsigned short c4)
     784KJS::UChar Lexer::convertUnicode(int c1, int c2, int c3, int c4)
    788785{
    789786  return KJS::UChar((convertHex(c1) << 4) + convertHex(c2),
     
    791788}
    792789
    793 void Lexer::record8(unsigned short c)
    794 {
    795   assert(c <= 0xff);
     790void Lexer::record8(int c)
     791{
     792  ASSERT(c >= 0);
     793  ASSERT(c <= 0xff);
    796794
    797795  // enlarge buffer if full
Note: See TracChangeset for help on using the changeset viewer.