@@ -183,12 +183,16 @@ public static String getElementType(ASTTerm t)
183183
184184
185185 public boolean hasType (String str )
186- { if ("integer" .equalsIgnoreCase (str ))
186+ { if ("character" .equalsIgnoreCase (str ))
187+ { return isCharacter (); }
188+ if ("integer" .equalsIgnoreCase (str ))
187189 { return isInteger (); }
188190 if ("real" .equalsIgnoreCase (str ))
189191 { return isReal (); }
190192 if ("boolean" .equalsIgnoreCase (str ))
191- { return isBoolean (); }
193+ { return isBoolean (); }
194+ if ("String" .equalsIgnoreCase (str ))
195+ { return isString (); }
192196
193197 if ("Sequence" .equals (str ))
194198 { return isSequence (); }
@@ -377,38 +381,61 @@ public static boolean isBoolean(String typ)
377381 }
378382
379383 public boolean isString ()
380- { String typ = ASTTerm .getType (literalForm ());
384+ { String litf = literalForm ();
385+ String typ = ASTTerm .getType (litf );
381386 if (typ == null )
382- { return false ; }
387+ { return Expression . isString ( litf ) ; }
383388 return
384389 "String" .equals (typ ) || "Character" .equals (typ ) ||
385390 "StringBuffer" .equals (typ ) || "char" .equals (typ ) ||
386391 "StringBuilder" .equals (typ );
387392 }
388393
394+ public boolean isCharacter ()
395+ { String s = literalForm ();
396+ if (s .length () > 2 && s .startsWith ("'" ) &&
397+ s .endsWith ("'" ))
398+ { return true ; }
399+ return false ;
400+ }
401+
389402 public boolean isInteger ()
390- { String typ = ASTTerm .getType (literalForm ());
391- if (typ == null )
392- { return false ; }
403+ { String litf = literalForm ();
404+ String typ = ASTTerm .getType (litf );
405+ if (typ == null )
406+ { return Expression .isInteger (litf ) ||
407+ Expression .isLong (litf );
408+ }
393409 return ASTTerm .isInteger (typ );
394410 }
395411
396412 public boolean isReal ()
397- { String typ = ASTTerm .getType (literalForm ());
413+ { String litf = literalForm ();
414+ String typ = ASTTerm .getType (litf );
398415 if (typ == null )
399- { return false ; }
416+ { return Expression . isDouble ( litf ) ; }
400417 return ASTTerm .isReal (typ );
401418 }
402419
403420 public boolean isNumber ()
404- { String typ = ASTTerm .getType (literalForm ());
421+ { String litf = literalForm ();
422+ String typ = ASTTerm .getType (litf );
423+ if (typ == null )
424+ { return Expression .isInteger (litf ) ||
425+ Expression .isLong (litf ) ||
426+ Expression .isDouble (litf );
427+ }
428+
405429 return ASTTerm .isReal (typ ) || ASTTerm .isInteger (typ );
406430 }
407431
408432 public boolean isBoolean ()
409- { String typ = ASTTerm .getType (literalForm ());
433+ { String litf = literalForm ();
434+ String typ = ASTTerm .getType (litf );
410435 if (typ == null )
411- { return false ; }
436+ { return "true" .equalsIgnoreCase (litf ) ||
437+ "false" .equalsIgnoreCase (litf );
438+ }
412439 return
413440 "boolean" .equals (typ ) || "Boolean" .equals (typ );
414441 }
0 commit comments