Java Doc for CAnalyzer.java in  » Parser » Rats-Parser-Generators » xtc » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » Rats Parser Generators » xtc.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   xtc.tree.Visitor
      xtc.lang.CAnalyzer

CAnalyzer
public class CAnalyzer extends Visitor (Code)
A visitor to type check C programs.
author:
   Robert Grimm
version:
   $Revision: 1.197 $

Inner Class :public class Specifiers extends Visitor
Inner Class :static class State
Inner Class :public class Initializer
Inner Class :public static class CompletenessCheck

Field Summary
final protected static  StringEXTERN_PATH
     The fully qualified name of the scope for external declarations.
final protected static  StringEXTERN_SCOPE
     The relative name of the scope for external declarations.
final protected static  StringMARKED
     The name of the node property indicating that a node has already been marked with its type during initializer processing.
final protected static  StringTMP_SCOPE
     The relative name of the temporary scope for parameter declarations.
protected  List<CompletenessCheck>checks
     The list of completeness checks to perform at the end of a translation unit.
final protected  Ccops
     The common type operations for C.
protected  booleanhasScope
     The flag for whether the immediately nested compound statement has a scope.
protected  booleanisStmtAsExpr
     The flag for a statement as expression node.
protected  booleanisTopLevel
     The flag for whether the current declaration is top-level, that is, an external declaration.
protected  List<Boolean>loops
     The list of loop statement flags.
final protected  booleanpedantic
     The flag for pedantic mode.
final protected  Runtimeruntime
     The runtime.
protected  List<Boolean>switches
     The list of switch statement flags.
protected  SymbolTabletable
     The symbol table.

Constructor Summary
public  CAnalyzer(Runtime runtime)
     Create a new C analyzer.
public  CAnalyzer(C cops, Runtime runtime)
     Create a new C analyzer.

Method Summary
public  SymbolTableanalyze(Node unit)
     Analyze the specified translation unit.
Parameters:
  unit - The translation unit.
public  SymbolTableanalyze(Node unit, SymbolTable table)
     Process the specified translation unit.
Parameters:
  unit - The translation unit.
Parameters:
  table - The symbol table.
public  Cc()
     Get this analyzer's common type operations for the C language.
protected  voidcheckDefinedLabels(GNode function)
     Check that all labels defined in the specified top-level function are also used.
public  booleancheckType(GNode node, String name, Type type)
     Check that the specified type is well-formed.
protected  voidcheckUsedLabels(GNode function)
     Check that all labels used in the specified top-level function are also defined.
public  Typecompose(GNode decl, String name, Type type, Type previous, boolean isFuncDef)
     Compose the specified type with the type of the previous declaration.
public  voiddefineExtern(String name, Type type)
     Define the specified name in the scope for extern declarations.
public  booleanensureArithmetic(Node n, Type t)
     Ensure that the specified node with the specified type represents an arithmetic type.
Parameters:
  n - The node.
Parameters:
  t - The type.
public  booleanensureInteger(Node n, Type t)
     Ensure that the specified note with the specified type represents an integer.
Parameters:
  n - The node.
Parameters:
  t - The type.
public  booleanensureLValue(Node n, Type t)
     Ensure that the specified node with the specified type represents a modifiable lvalue.
Parameters:
  n - The node.
Parameters:
  t - The type.
public  booleanensurePointerArithmetic(Node n, Type t)
     Ensure that the specified node represents valid pointer arithmetic for the specified type.
public  booleanensureScalar(Node n, Type t)
     Ensure that the specified node with the specified type represents a scalar.
Parameters:
  n - The node.
Parameters:
  t - the type.
public static  GNodegetDeclaredId(GNode declarator)
     Get the declared identifier from the specified declarator.
Parameters:
  declarator - The declarator, which may be abstract ornull.
public  TypegetDeclaredType(Type base, GNode declarator)
     Get the declared type.
public  TypegetDeclaredType(boolean isParam, Type base, GNode declarator)
     Get the declared type.
public static  GNodegetFunctionDeclarator(GNode declarator)
     Get the innermost function declarator from the specified declarator.
public  FunctionTgetParameterTypes(GNode parameters)
     Get the parameter types for the specified parameter declaration. As a side effect, this method reports any errors in a parameter's declaration specifiers, any void parameters (besides a single void specifier), any multiple parameters in old-style declarations, and any parameter redefinitions in new-style declarations.
Parameters:
  parameters - The parameters, which may be null.
public static  GNodegetSpecifier(String name, GNode specifiers)
     Get the first declaration specifier with the specified name.
Parameters:
  name - The name.
Parameters:
  specifiers - The specifiers.
public static  booleanisFunctionScope(String name)
     Determine whether the specified scope name represents a function or macro scope.
Parameters:
  name - The name.
protected  booleanisInitializable(Type t1, Type t2)
     Determine whether the specified left-hand type can be initialized from the specified right-hand type.
Parameters:
  t1 - The left-hand type.
Parameters:
  t2 - The right-hand type.
public  booleanisVoidParameterTypeList(GNode parameters)
     Determine whether the specified parameter type list represents a function taking no arguments.
public  TypelookupExtern(String name)
     Look up the specified name in the scope for extern declarations.
Parameters:
  name - The name.
public  voidmark(Node node, Type type)
     Mark the specified node with the specified type.
public  SpecifiersnewSpecifiers(GNode specifiers, boolean refIsDecl)
     Create a new sequence of specifiers.
protected  TypeprocessAddress(GNode n, Type type)
     Process the specified address expression.
protected  TypeprocessAssignment(boolean init, String op, Node n, Type t1, Type t2)
     Process the assignment.
public  TypeprocessExpression(Node n)
     Process the specified expression node.
protected  TypeprocessIndirection(Node n, Type type, boolean warn)
     Process the specified indirection expression.
Parameters:
  n - The node.
Parameters:
  type - The type.
Parameters:
  warn - The flag for whether to emit any warnings.
protected  TypeprocessInitializer(GNode expr, String name, Type left, GNode literal)
     Process the specified initializer.
protected  TypeprocessOffset(Type base, GNode selection)
     Process the specified offset selection.
Parameters:
  base - The base type.
Parameters:
  selection - The selection.
protected  voidprocessParameters(GNode node, FunctionT function)
     Process the specified function's parameters.
protected  TypeprocessSelection(Node node, Type type, String name, boolean indirect)
     Process a component selection.
protected  TypeprocessStringSize(GNode expr, String desc, boolean nested, Type left, Type right)
     Process the string sizes for the specified types.
protected  TypeprocessSubscript(Node n, Type base, Type index)
     Process the specified subscript expression.
Parameters:
  n - The node.
Parameters:
  base - The base type.
Parameters:
  index - The index type.
public  voidreportPrevious(String name, Type type)
     Report a previous declaration or definition.
public  voidreportPreviousTag(Type type)
     Report a previous declaration or definition of the specified tagged type.
public  List<Attribute>toAttributeList(GNode spec)
     Convert the specified GCC attribute specifier or GCC attribute specifier list to an xtc attribute list.
public  StringtoAttributeName(String s)
     Convert the specified string to an attribute name.
Parameters:
  s - The string.
public  ObjecttoAttributeValue(GNode node)
     Convert the specified node to an attribute value.
public static  StringtoDescription(Node n)
     Convert the specified node representing an operand to its description.
Parameters:
  n - The node.
public static  TypetoFuncType(String name)
     Create __func__'s type for the function with the specified name.
Parameters:
  name - The function name.
public static  StringtoFunctionName(Node n)
     Convert the specified node representing a function to its name.
Parameters:
  n - The node.
protected  TypevalueConditional(Type result, Type t1, Type t2, Type t3)
     Determine a conditional expression's value.
public  voidvisit(GNode n)
     Visit the specified generic node.
public  TypevisitAdditiveExpression(GNode n)
     Visit the specified additive expression.
public  TypevisitAddressExpression(GNode n)
     Visit the specified address expression.
public  TypevisitAlignofExpression(GNode n)
     Visit the specified alignof expression.
public  TypevisitAssignmentExpression(GNode n)
     Visit the specified assignment expression.
public  TypevisitBitwiseAndExpression(GNode n)
     Visit the specified bitwise and expression.
public  TypevisitBitwiseNegationExpression(GNode n)
     Visit the specified bitwise negation expression.
public  TypevisitBitwiseOrExpression(GNode n)
     Visit the specified bitwise or expression.
public  TypevisitBitwiseXorExpression(GNode n)
     Visit the specified bitwise xor expression.
public  voidvisitBreakStatement(GNode n)
     Visit the specified break statement.
public  voidvisitCaseLabel(GNode n)
     Visit the specified case label.
public  TypevisitCastExpression(GNode n)
     Visit the specified cast expression.
public  TypevisitCharacterConstant(GNode n)
     Visit the specified character constant.
public  TypevisitCommaExpression(GNode n)
     Visit the specified comma expression.
public  TypevisitCompoundLiteral(GNode n)
     Visit the specified compound literal.
public  TypevisitCompoundStatement(GNode n)
     Visit the specified compound statement.
public  TypevisitConditionalExpression(GNode n)
     Visit the specified conditional expression.
public  voidvisitContinueStatement(GNode n)
     Visit the specified continue statement.
public  voidvisitDeclaration(GNode n)
     Visit the specified declaration.
public  voidvisitDefaultLabel(GNode n)
     Visit the specified default label.
public  TypevisitDirectComponentSelection(GNode n)
     Visit the specified direct component selection.
public  voidvisitDoStatement(GNode n)
     Visit the specified do statement.
public  TypevisitEqualityExpression(GNode n)
     Visit the specified equality expression.
public  ListvisitExpressionList(GNode n)
     Visit the specified expression list.
public  TypevisitExpressionStatement(GNode n)
     Visit the specified expression statement.
public  TypevisitExtensionExpression(GNode n)
     Visit the specified extension expression.
public  TypevisitFloatingConstant(GNode n)
     Visit the specified floating constant.
public  voidvisitForStatement(GNode n)
     Visit the specified for statement.
public  TypevisitFunctionCall(GNode n)
     Visit the specified function call.
public  voidvisitFunctionDefinition(GNode n)
     Visit the specified function definition.
public  voidvisitGotoStatement(GNode n)
     Visit the specified goto statement.
public  voidvisitIfElseStatement(GNode n)
     Visit the specified if else statement.
public  voidvisitIfStatement(GNode n)
     Visit the specified if else statement.
public  TypevisitIndirectComponentSelection(GNode n)
     Visit the specified indirect component selection.
public  TypevisitIndirectionExpression(GNode n)
     Visit the specified indirection expression.
public  TypevisitIntegerConstant(GNode n)
     Visit the specified integer constant.
public  TypevisitLabelAddressExpression(GNode n)
     Visit the specified label address expression.
public  TypevisitLabeledStatement(GNode n)
     Visit the specified labeled statement.
public  voidvisitLocalLabelDeclaration(GNode n)
     Visit the specified local label declaration.
public  TypevisitLogicalAndExpression(GNode n)
     Visit the specified logical and expression.
public  TypevisitLogicalNegationExpression(GNode n)
     Visit the specified logical negation expression.
public  TypevisitLogicalOrExpression(GNode n)
     Visit the specified logical or expression.
public  TypevisitMultiplicativeExpression(GNode n)
     Visit the specified multiplicative expression.
public  voidvisitNamedLabel(GNode n)
     Visit the specified named label.
public  TypevisitOffsetofExpression(GNode n)
     Visit the specified offset of expression.
public  TypevisitPostdecrementExpression(GNode n)
     Visit the specified postdecrement expression.
public  TypevisitPostincrementExpression(GNode n)
     Visit the specified postincrement expression.
public  TypevisitPredecrementExpression(GNode n)
     Visit the specified predecrement expression.
public  TypevisitPreincrementExpression(GNode n)
     Visit the specified preincrement expression.
public  TypevisitPrimaryIdentifier(GNode n)
     Visit the specified primary identifier.
public  TypevisitRelationalExpression(GNode n)
     Visit the specified relational expression.
public  TypevisitReturnStatement(GNode n)
     Visit the specified return statement.
public  TypevisitShiftExpression(GNode n)
     Visit the specified shift expression.
public  TypevisitSizeofExpression(GNode n)
     Visit the specified sizeof expression.
public  TypevisitStatementAsExpression(GNode n)
     Visit the specified statement as expression.
public  TypevisitStringConstant(GNode n)
     Visit the specified string constant.
public  TypevisitSubscriptExpression(GNode n)
     Visit the specified subscript expression.
public  voidvisitSwitchStatement(GNode n)
     Visit the specified switch statement.
public  voidvisitTranslationUnit(GNode n)
     Visit the specified translation unit.
public  TypevisitTypeCompatibilityExpression(GNode n)
     Visit the specified type compatibility expression.
public  TypevisitTypeName(GNode n)
     Visit the specified type name.
public  TypevisitUnaryMinusExpression(GNode n)
     Visit the specified unary minus expression.
public  TypevisitUnaryPlusExpression(GNode n)
     Visit the specified unary plus expression.
public  TypevisitVariableArgumentAccess(GNode n)
     Visit the specified variable argument access.
public  voidvisitWhileStatement(GNode n)
     Visit the specified while statement.

Field Detail
EXTERN_PATH
final protected static String EXTERN_PATH(Code)
The fully qualified name of the scope for external declarations.



EXTERN_SCOPE
final protected static String EXTERN_SCOPE(Code)
The relative name of the scope for external declarations.



MARKED
final protected static String MARKED(Code)
The name of the node property indicating that a node has already been marked with its type during initializer processing.



TMP_SCOPE
final protected static String TMP_SCOPE(Code)
The relative name of the temporary scope for parameter declarations.



checks
protected List<CompletenessCheck> checks(Code)
The list of completeness checks to perform at the end of a translation unit.



cops
final protected C cops(Code)
The common type operations for C.



hasScope
protected boolean hasScope(Code)
The flag for whether the immediately nested compound statement has a scope.



isStmtAsExpr
protected boolean isStmtAsExpr(Code)
The flag for a statement as expression node. This flag is true if the current compound statement is nested within a statement as expression node.



isTopLevel
protected boolean isTopLevel(Code)
The flag for whether the current declaration is top-level, that is, an external declaration.



loops
protected List<Boolean> loops(Code)
The list of loop statement flags. For each nested loop statement, this list contains exactly one boolean.



pedantic
final protected boolean pedantic(Code)
The flag for pedantic mode.



runtime
final protected Runtime runtime(Code)
The runtime.



switches
protected List<Boolean> switches(Code)
The list of switch statement flags. For each nested switch statement, this list contains exactly one boolean, which is true if a default label has been seen.



table
protected SymbolTable table(Code)
The symbol table.




Constructor Detail
CAnalyzer
public CAnalyzer(Runtime runtime)(Code)
Create a new C analyzer. The newly created analyzer uses C for common type operations.
Parameters:
  runtime - The runtime.



CAnalyzer
public CAnalyzer(C cops, Runtime runtime)(Code)
Create a new C analyzer.
Parameters:
  cops - The common type operations for C.
Parameters:
  runtime - The runtime.




Method Detail
analyze
public SymbolTable analyze(Node unit)(Code)
Analyze the specified translation unit.
Parameters:
  unit - The translation unit. The corresponding symbol table.



analyze
public SymbolTable analyze(Node unit, SymbolTable table)(Code)
Process the specified translation unit.
Parameters:
  unit - The translation unit.
Parameters:
  table - The symbol table. The symbol table.



c
public C c()(Code)
Get this analyzer's common type operations for the C language. The common type operations.



checkDefinedLabels
protected void checkDefinedLabels(GNode function)(Code)
Check that all labels defined in the specified top-level function are also used. This method requires that all relevant AST nodes have been associated with their symbol table Constants.SCOPE scopes and that all used labels have been annotated as Constants.ATT_USED used .
Parameters:
  function - The function to check.



checkType
public boolean checkType(GNode node, String name, Type type)(Code)
Check that the specified type is well-formed. This method checks that the specified type is not an array of functions, not a function returning an array or a function, and not a pointer to either of the first two types.
Parameters:
  node - The declaring node.
Parameters:
  name - The optional name.
Parameters:
  type - The type. true if the type is well-formed.



checkUsedLabels
protected void checkUsedLabels(GNode function)(Code)
Check that all labels used in the specified top-level function are also defined. This method requires that all relevant AST nodes have been associated with their symbol table Constants.SCOPE scopes .
Parameters:
  function - The function to check.



compose
public Type compose(GNode decl, String name, Type type, Type previous, boolean isFuncDef)(Code)
Compose the specified type with the type of the previous declaration. This method composes compatible object and function types with each other, while also reporting any errors.
Parameters:
  decl - The current declaration's node.
Parameters:
  name - The identifier name.
Parameters:
  type - The current declaration's type.
Parameters:
  previous - The previous declaration's type.
Parameters:
  isFuncDef - The flag for whether the composition is for afunction definition. The composite type or ErrorT.TYPE if the twotypes are not compatible.



defineExtern
public void defineExtern(String name, Type type)(Code)
Define the specified name in the scope for extern declarations.
Parameters:
  name - The name.
Parameters:
  type - The type.



ensureArithmetic
public boolean ensureArithmetic(Node n, Type t)(Code)
Ensure that the specified node with the specified type represents an arithmetic type.
Parameters:
  n - The node.
Parameters:
  t - The type. true if the specified node represents anarithmetic type.



ensureInteger
public boolean ensureInteger(Node n, Type t)(Code)
Ensure that the specified note with the specified type represents an integer.
Parameters:
  n - The node.
Parameters:
  t - The type. true if the specified node represents aninteger.



ensureLValue
public boolean ensureLValue(Node n, Type t)(Code)
Ensure that the specified node with the specified type represents a modifiable lvalue.
Parameters:
  n - The node.
Parameters:
  t - The type. true if the specified node represents amodifiable lvalue.



ensurePointerArithmetic
public boolean ensurePointerArithmetic(Node n, Type t)(Code)
Ensure that the specified node represents valid pointer arithmetic for the specified type. If the specified type is a pointer, this method ensures that the pointer points to a complete type. For all other types besides the error type, it returns true.
Parameters:
  n - The node.
Parameters:
  t - The type. true if the specified node represents validpointer arithmetic.



ensureScalar
public boolean ensureScalar(Node n, Type t)(Code)
Ensure that the specified node with the specified type represents a scalar.
Parameters:
  n - The node.
Parameters:
  t - the type. true if the specified node represents ascalar.



getDeclaredId
public static GNode getDeclaredId(GNode declarator)(Code)
Get the declared identifier from the specified declarator.
Parameters:
  declarator - The declarator, which may be abstract ornull. The simple declarator node representing the declaredidentifier or null if the specified declarator isabstract or null.



getDeclaredType
public Type getDeclaredType(Type base, GNode declarator)(Code)
Get the declared type. The type is not a parameter type.
Parameters:
  base - The base type.
Parameters:
  declarator - The declarator, which may be abstract ornull. The declared type.



getDeclaredType
public Type getDeclaredType(boolean isParam, Type base, GNode declarator)(Code)
Get the declared type. In addition to determining the declared type, this method checks that any static storage class specifier or type qualifiers only appear in an array declarator if the declarator is part of a parameter declaration.
Parameters:
  isParam - The flag for whether the type is a parameter type.
Parameters:
  base - The base type.
Parameters:
  declarator - The declarator, which may be abstract ornull. The declared type.



getFunctionDeclarator
public static GNode getFunctionDeclarator(GNode declarator)(Code)
Get the innermost function declarator from the specified declarator. The innermost function declarator's parameters are the parameters for a function declaration or definition.
Parameters:
  declarator - The declarator. The innermost function declarator or null ifthe declarator does not contains a function declarator.



getParameterTypes
public FunctionT getParameterTypes(GNode parameters)(Code)
Get the parameter types for the specified parameter declaration. As a side effect, this method reports any errors in a parameter's declaration specifiers, any void parameters (besides a single void specifier), any multiple parameters in old-style declarations, and any parameter redefinitions in new-style declarations.
Parameters:
  parameters - The parameters, which may be null. The corresponding function type with the argument typesand variable flag filled in.



getSpecifier
public static GNode getSpecifier(String name, GNode specifiers)(Code)
Get the first declaration specifier with the specified name.
Parameters:
  name - The name.
Parameters:
  specifiers - The specifiers. The corresponding declaration specifier ornull if no such specifier exists.



isFunctionScope
public static boolean isFunctionScope(String name)(Code)
Determine whether the specified scope name represents a function or macro scope.
Parameters:
  name - The name. true if the specified name represents afunction or macro scope.



isInitializable
protected boolean isInitializable(Type t1, Type t2)(Code)
Determine whether the specified left-hand type can be initialized from the specified right-hand type.
Parameters:
  t1 - The left-hand type.
Parameters:
  t2 - The right-hand type. true if the left-hand type can beinitialized by the right-hand type.



isVoidParameterTypeList
public boolean isVoidParameterTypeList(GNode parameters)(Code)
Determine whether the specified parameter type list represents a function taking no arguments. This method checks whether the parameter type list contains a single parameter without a declarator, whose specifiers either contains a void type specifier or a typedef name aliasing void. Though the parameter type list may still be malformed, e.g., contain a qualifier, storage class, or another type specifier.
Parameters:
  parameters - The parameter type list. true if the corresponding function takes noarguments.



lookupExtern
public Type lookupExtern(String name)(Code)
Look up the specified name in the scope for extern declarations.
Parameters:
  name - The name. The corresponding type or null if no suchbinding exists.



mark
public void mark(Node node, Type type)(Code)
Mark the specified node with the specified type. As a side-effect, this method also seals the specified type.
Parameters:
  node - The node.
Parameters:
  type - The type.



newSpecifiers
public Specifiers newSpecifiers(GNode specifiers, boolean refIsDecl)(Code)
Create a new sequence of specifiers. This factory method should be used instead of allocating an instance of Specifiers directly, so that the processing of declaration specifiers can be customized by subclasses.
Parameters:
  specifiers - The node holding the declaration specifiers(which may be null).
Parameters:
  refIsDecl - The flag for whether a struct/union referencealso is a struct/union declaration. The sequence of specifiers.



processAddress
protected Type processAddress(GNode n, Type type)(Code)
Process the specified address expression. This method assumes that the specified node neither is an indirection nor a subscript expression.
Parameters:
  n - The node.
Parameters:
  type - The type. The resulting type.



processAssignment
protected Type processAssignment(boolean init, String op, Node n, Type t1, Type t2)(Code)
Process the assignment. This method determines the resulting type when assigning a value of the specified right-hand type to an object with the specified left-hand type. It does not check that the left-hand side represents a modifiable lvalue.
Parameters:
  init - The flag for whether the assignment is in aninitializer.
Parameters:
  op - The name of the operation.
Parameters:
  n - The node.
Parameters:
  t1 - The left-hand type.
Parameters:
  t2 - The right-hand type. The resulting type.



processExpression
public Type processExpression(Node n)(Code)
Process the specified expression node. This method simply dispatches this visitor on the specified node and returns the resulting type. It is typically used from other visitors nested in this class.
Parameters:
  n - The expression node. The corresponding type.



processIndirection
protected Type processIndirection(Node n, Type type, boolean warn)(Code)
Process the specified indirection expression.
Parameters:
  n - The node.
Parameters:
  type - The type.
Parameters:
  warn - The flag for whether to emit any warnings. The resulting type.



processInitializer
protected Type processInitializer(GNode expr, String name, Type left, GNode literal)(Code)
Process the specified initializer. This method checks that the specified initializer is consistent with the specified type. It also completes the type based on the literal.
Parameters:
  expr - The overall expression node.
Parameters:
  name - The name of the variable being initialized, which maybe null.
Parameters:
  left - The left-hand type.
Parameters:
  literal - The literal node.



processOffset
protected Type processOffset(Type base, GNode selection)(Code)
Process the specified offset selection.
Parameters:
  base - The base type.
Parameters:
  selection - The selection. The selected type or ErrorT.TYPE on errors.



processParameters
protected void processParameters(GNode node, FunctionT function)(Code)
Process the specified function's parameters. This method checks that all parameters are named and have valid and complete types. Furthermore, for old-style function definitions, it checks that the parameter types are consistent with any previous new-style declaration and, for previous old-style declarations, updates the function's type with the parameter types. Finally, it adds the appropriate definitions to the current symbol table scope.

Note that the specified type is expected to be the result of composing the defined type with any previous declarations. For old-style definitions, this type contains the parameter types of any previous new-style declaration or is old-style as well, if any previous declarations are also old-style.
Parameters:
  node - The node representing the function.
Parameters:
  function - The function's type.




processSelection
protected Type processSelection(Node node, Type type, String name, boolean indirect)(Code)
Process a component selection. This method extracts the member type for the member with the specified name from the specified struct or union type.
Parameters:
  node - The node.
Parameters:
  type - The type.
Parameters:
  name - The name of the member.
Parameters:
  indirect - The flag for whether the component selection isindirect. The corresponding member type or an error type in case ofa malformed type or field name.



processStringSize
protected Type processStringSize(GNode expr, String desc, boolean nested, Type left, Type right)(Code)
Process the string sizes for the specified types. If the specified types are not compatible string types or the right-hand type does no represent a string constant, this method simply returns the specified left-hand type. Otherwise, if the left-hand type is an incomplete array and the expression is not nested, this method updates a copy of the left-hand type and returns that copy. If the left-hand type is a complete array and the right-hand type is longer, it emits a warning.
Parameters:
  expr - The overall expression node.
Parameters:
  desc - The description.
Parameters:
  nested - The flag for nested initializers.
Parameters:
  left - The left-hand type.
Parameters:
  right - The right-hand type. The updated type.



processSubscript
protected Type processSubscript(Node n, Type base, Type index)(Code)
Process the specified subscript expression.
Parameters:
  n - The node.
Parameters:
  base - The base type.
Parameters:
  index - The index type. The corresponding element type or an error type in caseof an error.



reportPrevious
public void reportPrevious(String name, Type type)(Code)
Report a previous declaration or definition. If the specified type has a location, this method prints that location as a previous declaration or definition.
Parameters:
  name - The name.
Parameters:
  type - The type.



reportPreviousTag
public void reportPreviousTag(Type type)(Code)
Report a previous declaration or definition of the specified tagged type. If the specified type has a location, this method prints that location as a previous declaration or definition.
Parameters:
  type - The type.



toAttributeList
public List<Attribute> toAttributeList(GNode spec)(Code)
Convert the specified GCC attribute specifier or GCC attribute specifier list to an xtc attribute list. If the specified node is null, this method returns an empty list. Otherwise, it returns a newly allocated, unsealed list.
Parameters:
  spec - The GCC attribute specifier (list). The corresponding xtc attributes.



toAttributeName
public String toAttributeName(String s)(Code)
Convert the specified string to an attribute name.
Parameters:
  s - The string. The corresponding name.



toAttributeValue
public Object toAttributeValue(GNode node)(Code)
Convert the specified node to an attribute value. This method converts a node representing a GCC attribute's value to the actual attribute's value:
  • If the node is null or an empty expression list, this method returns null.
  • If the node is an expression list with one element, it returns the result of recursively processing that element.
  • If the node is an expression list with more than one element, it recursively processes each element, returning a new Java collections framework list.
  • If the node is a primary identifier, it returns the corresponding symbol (without checking that the symbol is defined).
  • If the node is a constant expression, it returns the corresponding value.
  • Otherwise, it returns the AST node.

Parameters:
  node - The node. The corresponding value.



toDescription
public static String toDescription(Node n)(Code)
Convert the specified node representing an operand to its description.
Parameters:
  n - The node. The corresponding description.



toFuncType
public static Type toFuncType(String name)(Code)
Create __func__'s type for the function with the specified name.
Parameters:
  name - The function name. The corresponding type.



toFunctionName
public static String toFunctionName(Node n)(Code)
Convert the specified node representing a function to its name.
Parameters:
  n - The node. The corresponding name or null if the namecannot be determined.



valueConditional
protected Type valueConditional(Type result, Type t1, Type t2, Type t3)(Code)
Determine a conditional expression's value. If a conditional expression's value can be statically determined, this method annotates the expression's result with that value.
Parameters:
  result - The result type.
Parameters:
  t1 - The conditional's type.
Parameters:
  t2 - The consequence's type.
Parameters:
  t3 - The alternative's type. The annotated result type.



visit
public void visit(GNode n)(Code)
Visit the specified generic node.



visitAdditiveExpression
public Type visitAdditiveExpression(GNode n)(Code)
Visit the specified additive expression.



visitAddressExpression
public Type visitAddressExpression(GNode n)(Code)
Visit the specified address expression.



visitAlignofExpression
public Type visitAlignofExpression(GNode n)(Code)
Visit the specified alignof expression.



visitAssignmentExpression
public Type visitAssignmentExpression(GNode n)(Code)
Visit the specified assignment expression.



visitBitwiseAndExpression
public Type visitBitwiseAndExpression(GNode n)(Code)
Visit the specified bitwise and expression.



visitBitwiseNegationExpression
public Type visitBitwiseNegationExpression(GNode n)(Code)
Visit the specified bitwise negation expression.



visitBitwiseOrExpression
public Type visitBitwiseOrExpression(GNode n)(Code)
Visit the specified bitwise or expression.



visitBitwiseXorExpression
public Type visitBitwiseXorExpression(GNode n)(Code)
Visit the specified bitwise xor expression.



visitBreakStatement
public void visitBreakStatement(GNode n)(Code)
Visit the specified break statement.



visitCaseLabel
public void visitCaseLabel(GNode n)(Code)
Visit the specified case label.



visitCastExpression
public Type visitCastExpression(GNode n)(Code)
Visit the specified cast expression.



visitCharacterConstant
public Type visitCharacterConstant(GNode n)(Code)
Visit the specified character constant.



visitCommaExpression
public Type visitCommaExpression(GNode n)(Code)
Visit the specified comma expression.



visitCompoundLiteral
public Type visitCompoundLiteral(GNode n)(Code)
Visit the specified compound literal.



visitCompoundStatement
public Type visitCompoundStatement(GNode n)(Code)
Visit the specified compound statement.



visitConditionalExpression
public Type visitConditionalExpression(GNode n)(Code)
Visit the specified conditional expression.



visitContinueStatement
public void visitContinueStatement(GNode n)(Code)
Visit the specified continue statement.



visitDeclaration
public void visitDeclaration(GNode n)(Code)
Visit the specified declaration.



visitDefaultLabel
public void visitDefaultLabel(GNode n)(Code)
Visit the specified default label.



visitDirectComponentSelection
public Type visitDirectComponentSelection(GNode n)(Code)
Visit the specified direct component selection.



visitDoStatement
public void visitDoStatement(GNode n)(Code)
Visit the specified do statement.



visitEqualityExpression
public Type visitEqualityExpression(GNode n)(Code)
Visit the specified equality expression.



visitExpressionList
public List visitExpressionList(GNode n)(Code)
Visit the specified expression list.



visitExpressionStatement
public Type visitExpressionStatement(GNode n)(Code)
Visit the specified expression statement.



visitExtensionExpression
public Type visitExtensionExpression(GNode n)(Code)
Visit the specified extension expression.



visitFloatingConstant
public Type visitFloatingConstant(GNode n)(Code)
Visit the specified floating constant.



visitForStatement
public void visitForStatement(GNode n)(Code)
Visit the specified for statement.



visitFunctionCall
public Type visitFunctionCall(GNode n)(Code)
Visit the specified function call.



visitFunctionDefinition
public void visitFunctionDefinition(GNode n)(Code)
Visit the specified function definition.



visitGotoStatement
public void visitGotoStatement(GNode n)(Code)
Visit the specified goto statement.



visitIfElseStatement
public void visitIfElseStatement(GNode n)(Code)
Visit the specified if else statement.



visitIfStatement
public void visitIfStatement(GNode n)(Code)
Visit the specified if else statement.



visitIndirectComponentSelection
public Type visitIndirectComponentSelection(GNode n)(Code)
Visit the specified indirect component selection.



visitIndirectionExpression
public Type visitIndirectionExpression(GNode n)(Code)
Visit the specified indirection expression.



visitIntegerConstant
public Type visitIntegerConstant(GNode n)(Code)
Visit the specified integer constant.



visitLabelAddressExpression
public Type visitLabelAddressExpression(GNode n)(Code)
Visit the specified label address expression.



visitLabeledStatement
public Type visitLabeledStatement(GNode n)(Code)
Visit the specified labeled statement.



visitLocalLabelDeclaration
public void visitLocalLabelDeclaration(GNode n)(Code)
Visit the specified local label declaration.



visitLogicalAndExpression
public Type visitLogicalAndExpression(GNode n)(Code)
Visit the specified logical and expression.



visitLogicalNegationExpression
public Type visitLogicalNegationExpression(GNode n)(Code)
Visit the specified logical negation expression.



visitLogicalOrExpression
public Type visitLogicalOrExpression(GNode n)(Code)
Visit the specified logical or expression.



visitMultiplicativeExpression
public Type visitMultiplicativeExpression(GNode n)(Code)
Visit the specified multiplicative expression.



visitNamedLabel
public void visitNamedLabel(GNode n)(Code)
Visit the specified named label.



visitOffsetofExpression
public Type visitOffsetofExpression(GNode n)(Code)
Visit the specified offset of expression.



visitPostdecrementExpression
public Type visitPostdecrementExpression(GNode n)(Code)
Visit the specified postdecrement expression.



visitPostincrementExpression
public Type visitPostincrementExpression(GNode n)(Code)
Visit the specified postincrement expression.



visitPredecrementExpression
public Type visitPredecrementExpression(GNode n)(Code)
Visit the specified predecrement expression.



visitPreincrementExpression
public Type visitPreincrementExpression(GNode n)(Code)
Visit the specified preincrement expression.



visitPrimaryIdentifier
public Type visitPrimaryIdentifier(GNode n)(Code)
Visit the specified primary identifier.



visitRelationalExpression
public Type visitRelationalExpression(GNode n)(Code)
Visit the specified relational expression.



visitReturnStatement
public Type visitReturnStatement(GNode n)(Code)
Visit the specified return statement.



visitShiftExpression
public Type visitShiftExpression(GNode n)(Code)
Visit the specified shift expression.



visitSizeofExpression
public Type visitSizeofExpression(GNode n)(Code)
Visit the specified sizeof expression.



visitStatementAsExpression
public Type visitStatementAsExpression(GNode n)(Code)
Visit the specified statement as expression.



visitStringConstant
public Type visitStringConstant(GNode n)(Code)
Visit the specified string constant.



visitSubscriptExpression
public Type visitSubscriptExpression(GNode n)(Code)
Visit the specified subscript expression.



visitSwitchStatement
public void visitSwitchStatement(GNode n)(Code)
Visit the specified switch statement.



visitTranslationUnit
public void visitTranslationUnit(GNode n)(Code)
Visit the specified translation unit.



visitTypeCompatibilityExpression
public Type visitTypeCompatibilityExpression(GNode n)(Code)
Visit the specified type compatibility expression.



visitTypeName
public Type visitTypeName(GNode n)(Code)
Visit the specified type name.



visitUnaryMinusExpression
public Type visitUnaryMinusExpression(GNode n)(Code)
Visit the specified unary minus expression.



visitUnaryPlusExpression
public Type visitUnaryPlusExpression(GNode n)(Code)
Visit the specified unary plus expression.



visitVariableArgumentAccess
public Type visitVariableArgumentAccess(GNode n)(Code)
Visit the specified variable argument access.



visitWhileStatement
public void visitWhileStatement(GNode n)(Code)
Visit the specified while statement.



Methods inherited from xtc.tree.Visitor
public Object dispatch(Node node)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.