• Julia Lawall's avatar
    annotations: add positions · 8e20ccf5
    Julia Lawall authored
    Extend the parser to record positions, in build_node,
    build_node_delete, and build_property.
    
    srcpos structures are added to the property and node types, and to the
    parameter lists of the above functions that construct these types.
    Nodes and properties that are created by the compiler rather than from
    parsing source code have NULL as the srcpos value.
    
    merge_nodes, defined in livetree.c, uses srcpos_extend to combine
    multiple positions, resulting in a list of positions.  srcpos_extend
    is defined in srcpos.c.  New elements are added at the end.  This
    requires the srcpos type, define in srcpos.h, to be a list structure
    with a next field.  This next field is initialized to NULL in
    srcpos.h, in the macro YYLLOC_DEFAULT invoked implicitly by the
    generated parser code.
    
    Another change to srcpos.c is to make srcpos_copy always do a full
    copy, including a copy of the file substructure.  This is required
    because when dtc is used on the output of cpp, the successive detected
    file names overwrite the file name in the file structure.  The next
    field does not need to be deep copied, because it is always NULL when
    srcpos_copy is called; an assert checks for this. File names are only
    updated in uncopied position structures.
    Signed-off-by: 's avatarJulia Lawall <Julia.Lawall@lip6.fr>
    Signed-off-by: 's avatarDavid Gibson <david@gibson.dropbear.id.au>
    8e20ccf5