The symbol table holds declarations for each symbol known to
a particular package.
Symbol tables are represented by
A symbol is an abstract representation of some object—a calculation, classification, typedef, etc.—containing the source location and useful metadata.
Produce a list of duplicate symbols in $symtable,
All duplicates will be returned—that is, if \(S_1\) appears before duplicate \(S_2\)
in the symbol table, both \(S_1\) and \(S_2\)
will be returned.
If two symbols have duplicate
@names but the same
then they are not considered to be duplicates,
unless another duplicate symbol of the
@name is found with a different
in which case all symbols will be returned.
An exception to this rule is made when both symbols lack a
meaning that they are both defined in the same package.
This allows sloppy comparison on concatenated symbol tables before
tidying it up.
Externs are ignored, since they represent symbols that need to be satisfied at some point—this will be checked during linking.
preproc:sym nodes) are returned by reference.
This method name is “find” duplicates rather than “get” to emphasize that processing is performed, which is potentially intensive given a large symbol table $symtable.
<function name="symtable:find-duplicates" as="element( preproc:sym )*"> <param name="symtable" as="element( preproc:syms )" /> <for-each-group select="$symtable/preproc:sym[ not( @extern = 'true' ) ]" group-by="@name"> <!-- @src may be omitted to convey a local symbol --> <variable name="srcs" as="xs:string*" select="distinct-values( for $sym in current-group() return if ( exists( $sym/@src ) ) then $sym/@src else '.' )" /> <sequence select="if ( count( $srcs ) gt 1 ) then current-group() else if ( ( $srcs[ 1 ] = '.' ) and ( count( current-group() ) gt 1 ) ) then current-group() else ()" /> </for-each-group> </function>
|• Symbol Format:||Anatomy of a symbol table entry|
|• Symbol Types:||Symbols describing various objects|
preproc namespace exists for legacy reasons;
it will change in the future.