< prev index next >

src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java

Print this page




1653     int radix = 10;
1654     if (string.length() > 1)
1655       if (string.charAt (0) == '0')
1656         if (string.charAt (1) == 'x' || string.charAt (1) == 'X')
1657         {
1658           string = string.substring (2);
1659           radix = 16;
1660         }
1661         else
1662           radix = 8;
1663     return new BigInteger (string, radix);
1664   } // parseString
1665 
1666   /**
1667    *
1668    **/
1669   private Terminal booleanLiteral () throws IOException, ParseException
1670   {
1671     Boolean bool = null;
1672     if (token.name.equals ("TRUE"))
1673       bool = new Boolean (true);
1674     else if (token.name.equals ("FALSE"))
1675       bool = new Boolean (false);
1676     else
1677     {
1678       ParseException.invalidConst (scanner, token.name);
1679       bool = new Boolean (false);
1680     }
1681     String name = token.name;
1682     match (Token.BooleanLiteral);
1683     return exprFactory.terminal (name, bool);
1684   } // booleanLiteral
1685 
1686   /**
1687    *
1688    **/
1689   private Expression stringLiteral () throws IOException, ParseException
1690   {
1691     // If string literals appear together, concatenate them.  Ie:
1692     // "Twas " "brillig " "and " "the " "slithy " "toves"
1693     // becomes
1694     // "Twas brillig and the slithy toves"
1695     boolean isWide = token.isWide() ;
1696     String literal = "";
1697     do
1698     {
1699       literal += token.name;




1653     int radix = 10;
1654     if (string.length() > 1)
1655       if (string.charAt (0) == '0')
1656         if (string.charAt (1) == 'x' || string.charAt (1) == 'X')
1657         {
1658           string = string.substring (2);
1659           radix = 16;
1660         }
1661         else
1662           radix = 8;
1663     return new BigInteger (string, radix);
1664   } // parseString
1665 
1666   /**
1667    *
1668    **/
1669   private Terminal booleanLiteral () throws IOException, ParseException
1670   {
1671     Boolean bool = null;
1672     if (token.name.equals ("TRUE"))
1673       bool = Boolean.TRUE;
1674     else if (token.name.equals ("FALSE"))
1675       bool = Boolean.FALSE;
1676     else
1677     {
1678       ParseException.invalidConst (scanner, token.name);
1679       bool = Boolean.FALSE;
1680     }
1681     String name = token.name;
1682     match (Token.BooleanLiteral);
1683     return exprFactory.terminal (name, bool);
1684   } // booleanLiteral
1685 
1686   /**
1687    *
1688    **/
1689   private Expression stringLiteral () throws IOException, ParseException
1690   {
1691     // If string literals appear together, concatenate them.  Ie:
1692     // "Twas " "brillig " "and " "the " "slithy " "toves"
1693     // becomes
1694     // "Twas brillig and the slithy toves"
1695     boolean isWide = token.isWide() ;
1696     String literal = "";
1697     do
1698     {
1699       literal += token.name;


< prev index next >