- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是解析方面的新手,我正在尝试使用 Pycparser 来解析我的 c 文件,我按照说明预处理文件 gcc -E 然后我使用示例文件夹中的 using_gcc_E_libc.py 并传递我的文件,我得到了一些输出,但不确定 AST 是否是这样的?如果那是正确的 AST,我如何找到每个节点及其依赖项以及该节点的指针(位置)?
FileAST:
Typedef: size_t, [], ['typedef']
TypeDecl: size_t, []
IdentifierType: ['int']
Typedef: __builtin_va_list, [], ['typedef']
TypeDecl: __builtin_va_list, []
IdentifierType: ['int']
Typedef: __gnuc_va_list, [], ['typedef']
TypeDecl: __gnuc_va_list, []
IdentifierType: ['int']
Typedef: va_list, [], ['typedef']
TypeDecl: va_list, []
IdentifierType: ['int']
Typedef: __int8_t, [], ['typedef']
TypeDecl: __int8_t, []
IdentifierType: ['int']
Typedef: __uint8_t, [], ['typedef']
TypeDecl: __uint8_t, []
IdentifierType: ['int']
Typedef: __int16_t, [], ['typedef']
TypeDecl: __int16_t, []
IdentifierType: ['int']
Typedef: __uint16_t, [], ['typedef']
TypeDecl: __uint16_t, []
IdentifierType: ['int']
Typedef: __int_least16_t, [], ['typedef']
TypeDecl: __int_least16_t, []
IdentifierType: ['int']
Typedef: __uint_least16_t, [], ['typedef']
TypeDecl: __uint_least16_t, []
IdentifierType: ['int']
Typedef: __int32_t, [], ['typedef']
TypeDecl: __int32_t, []
IdentifierType: ['int']
Typedef: __uint32_t, [], ['typedef']
TypeDecl: __uint32_t, []
IdentifierType: ['int']
Typedef: __int64_t, [], ['typedef']
TypeDecl: __int64_t, []
IdentifierType: ['int']
Typedef: __uint64_t, [], ['typedef']
TypeDecl: __uint64_t, []
IdentifierType: ['int']
Typedef: __int_least32_t, [], ['typedef']
TypeDecl: __int_least32_t, []
IdentifierType: ['int']
Typedef: __uint_least32_t, [], ['typedef']
TypeDecl: __uint_least32_t, []
IdentifierType: ['int']
Typedef: __s8, [], ['typedef']
TypeDecl: __s8, []
IdentifierType: ['int']
Typedef: __u8, [], ['typedef']
TypeDecl: __u8, []
IdentifierType: ['int']
Typedef: __s16, [], ['typedef']
TypeDecl: __s16, []
IdentifierType: ['int']
Typedef: __u16, [], ['typedef']
TypeDecl: __u16, []
IdentifierType: ['int']
Typedef: __s32, [], ['typedef']
TypeDecl: __s32, []
IdentifierType: ['int']
Typedef: __u32, [], ['typedef']
TypeDecl: __u32, []
IdentifierType: ['int']
Typedef: __s64, [], ['typedef']
TypeDecl: __s64, []
IdentifierType: ['int']
Typedef: __u64, [], ['typedef']
TypeDecl: __u64, []
IdentifierType: ['int']
Typedef: _LOCK_T, [], ['typedef']
TypeDecl: _LOCK_T, []
IdentifierType: ['int']
Typedef: _LOCK_RECURSIVE_T, [], ['typedef']
TypeDecl: _LOCK_RECURSIVE_T, []
IdentifierType: ['int']
Typedef: _off_t, [], ['typedef']
TypeDecl: _off_t, []
IdentifierType: ['int']
Typedef: __dev_t, [], ['typedef']
TypeDecl: __dev_t, []
IdentifierType: ['int']
Typedef: __uid_t, [], ['typedef']
TypeDecl: __uid_t, []
IdentifierType: ['int']
Typedef: __gid_t, [], ['typedef']
TypeDecl: __gid_t, []
IdentifierType: ['int']
Typedef: _off64_t, [], ['typedef']
TypeDecl: _off64_t, []
IdentifierType: ['int']
Typedef: _fpos_t, [], ['typedef']
TypeDecl: _fpos_t, []
IdentifierType: ['int']
Typedef: _ssize_t, [], ['typedef']
TypeDecl: _ssize_t, []
IdentifierType: ['int']
Typedef: wint_t, [], ['typedef']
TypeDecl: wint_t, []
IdentifierType: ['int']
Typedef: _mbstate_t, [], ['typedef']
TypeDecl: _mbstate_t, []
IdentifierType: ['int']
Typedef: _flock_t, [], ['typedef']
TypeDecl: _flock_t, []
IdentifierType: ['int']
Typedef: _iconv_t, [], ['typedef']
TypeDecl: _iconv_t, []
IdentifierType: ['int']
Typedef: __ULong, [], ['typedef']
TypeDecl: __ULong, []
IdentifierType: ['int']
Typedef: __FILE, [], ['typedef']
TypeDecl: __FILE, []
IdentifierType: ['int']
Typedef: ptrdiff_t, [], ['typedef']
TypeDecl: ptrdiff_t, []
IdentifierType: ['int']
Typedef: wchar_t, [], ['typedef']
TypeDecl: wchar_t, []
IdentifierType: ['int']
Typedef: __off_t, [], ['typedef']
TypeDecl: __off_t, []
IdentifierType: ['int']
Typedef: __pid_t, [], ['typedef']
TypeDecl: __pid_t, []
IdentifierType: ['int']
Typedef: __loff_t, [], ['typedef']
TypeDecl: __loff_t, []
IdentifierType: ['int']
Typedef: u_char, [], ['typedef']
TypeDecl: u_char, []
IdentifierType: ['int']
Typedef: u_short, [], ['typedef']
TypeDecl: u_short, []
IdentifierType: ['int']
Typedef: u_int, [], ['typedef']
TypeDecl: u_int, []
IdentifierType: ['int']
Typedef: u_long, [], ['typedef']
TypeDecl: u_long, []
IdentifierType: ['int']
Typedef: ushort, [], ['typedef']
TypeDecl: ushort, []
IdentifierType: ['int']
Typedef: uint, [], ['typedef']
TypeDecl: uint, []
IdentifierType: ['int']
Typedef: clock_t, [], ['typedef']
TypeDecl: clock_t, []
IdentifierType: ['int']
Typedef: time_t, [], ['typedef']
TypeDecl: time_t, []
IdentifierType: ['int']
Typedef: daddr_t, [], ['typedef']
TypeDecl: daddr_t, []
IdentifierType: ['int']
Typedef: caddr_t, [], ['typedef']
TypeDecl: caddr_t, []
IdentifierType: ['int']
Typedef: ino_t, [], ['typedef']
TypeDecl: ino_t, []
IdentifierType: ['int']
Typedef: off_t, [], ['typedef']
TypeDecl: off_t, []
IdentifierType: ['int']
Typedef: dev_t, [], ['typedef']
TypeDecl: dev_t, []
IdentifierType: ['int']
Typedef: uid_t, [], ['typedef']
TypeDecl: uid_t, []
IdentifierType: ['int']
Typedef: gid_t, [], ['typedef']
TypeDecl: gid_t, []
IdentifierType: ['int']
Typedef: pid_t, [], ['typedef']
TypeDecl: pid_t, []
IdentifierType: ['int']
Typedef: key_t, [], ['typedef']
TypeDecl: key_t, []
IdentifierType: ['int']
Typedef: ssize_t, [], ['typedef']
TypeDecl: ssize_t, []
IdentifierType: ['int']
Typedef: mode_t, [], ['typedef']
TypeDecl: mode_t, []
IdentifierType: ['int']
Typedef: nlink_t, [], ['typedef']
TypeDecl: nlink_t, []
IdentifierType: ['int']
Typedef: fd_mask, [], ['typedef']
TypeDecl: fd_mask, []
IdentifierType: ['int']
Typedef: _types_fd_set, [], ['typedef']
TypeDecl: _types_fd_set, []
IdentifierType: ['int']
Typedef: clockid_t, [], ['typedef']
TypeDecl: clockid_t, []
IdentifierType: ['int']
Typedef: timer_t, [], ['typedef']
TypeDecl: timer_t, []
IdentifierType: ['int']
Typedef: useconds_t, [], ['typedef']
TypeDecl: useconds_t, []
IdentifierType: ['int']
Typedef: suseconds_t, [], ['typedef']
TypeDecl: suseconds_t, []
IdentifierType: ['int']
Typedef: FILE, [], ['typedef']
TypeDecl: FILE, []
IdentifierType: ['int']
Typedef: fpos_t, [], ['typedef']
TypeDecl: fpos_t, []
IdentifierType: ['int']
Typedef: cookie_read_function_t, [], ['typedef']
TypeDecl: cookie_read_function_t, []
IdentifierType: ['int']
Typedef: cookie_write_function_t, [], ['typedef']
TypeDecl: cookie_write_function_t, []
IdentifierType: ['int']
Typedef: cookie_seek_function_t, [], ['typedef']
TypeDecl: cookie_seek_function_t, []
IdentifierType: ['int']
Typedef: cookie_close_function_t, [], ['typedef']
TypeDecl: cookie_close_function_t, []
IdentifierType: ['int']
Typedef: cookie_io_functions_t, [], ['typedef']
TypeDecl: cookie_io_functions_t, []
IdentifierType: ['int']
Typedef: div_t, [], ['typedef']
TypeDecl: div_t, []
IdentifierType: ['int']
Typedef: ldiv_t, [], ['typedef']
TypeDecl: ldiv_t, []
IdentifierType: ['int']
Typedef: lldiv_t, [], ['typedef']
TypeDecl: lldiv_t, []
IdentifierType: ['int']
Typedef: sigset_t, [], ['typedef']
TypeDecl: sigset_t, []
IdentifierType: ['int']
Typedef: __sigset_t, [], ['typedef']
TypeDecl: __sigset_t, []
IdentifierType: ['int']
Typedef: _sig_func_ptr, [], ['typedef']
TypeDecl: _sig_func_ptr, []
IdentifierType: ['int']
Typedef: sig_atomic_t, [], ['typedef']
TypeDecl: sig_atomic_t, []
IdentifierType: ['int']
Typedef: __tzrule_type, [], ['typedef']
TypeDecl: __tzrule_type, []
IdentifierType: ['int']
Typedef: __tzinfo_type, [], ['typedef']
TypeDecl: __tzinfo_type, []
IdentifierType: ['int']
Typedef: mbstate_t, [], ['typedef']
TypeDecl: mbstate_t, []
IdentifierType: ['int']
Typedef: sem_t, [], ['typedef']
TypeDecl: sem_t, []
IdentifierType: ['int']
Typedef: pthread_t, [], ['typedef']
TypeDecl: pthread_t, []
IdentifierType: ['int']
Typedef: pthread_attr_t, [], ['typedef']
TypeDecl: pthread_attr_t, []
IdentifierType: ['int']
Typedef: pthread_mutex_t, [], ['typedef']
TypeDecl: pthread_mutex_t, []
IdentifierType: ['int']
Typedef: pthread_mutexattr_t, [], ['typedef']
TypeDecl: pthread_mutexattr_t, []
IdentifierType: ['int']
Typedef: pthread_cond_t, [], ['typedef']
TypeDecl: pthread_cond_t, []
IdentifierType: ['int']
Typedef: pthread_condattr_t, [], ['typedef']
TypeDecl: pthread_condattr_t, []
IdentifierType: ['int']
Typedef: pthread_key_t, [], ['typedef']
TypeDecl: pthread_key_t, []
IdentifierType: ['int']
Typedef: pthread_once_t, [], ['typedef']
TypeDecl: pthread_once_t, []
IdentifierType: ['int']
Typedef: pthread_rwlock_t, [], ['typedef']
TypeDecl: pthread_rwlock_t, []
IdentifierType: ['int']
Typedef: pthread_rwlockattr_t, [], ['typedef']
TypeDecl: pthread_rwlockattr_t, []
IdentifierType: ['int']
Typedef: pthread_spinlock_t, [], ['typedef']
TypeDecl: pthread_spinlock_t, []
IdentifierType: ['int']
Typedef: pthread_barrier_t, [], ['typedef']
TypeDecl: pthread_barrier_t, []
IdentifierType: ['int']
Typedef: pthread_barrierattr_t, [], ['typedef']
TypeDecl: pthread_barrierattr_t, []
IdentifierType: ['int']
Typedef: jmp_buf, [], ['typedef']
TypeDecl: jmp_buf, []
IdentifierType: ['int']
Typedef: rlim_t, [], ['typedef']
TypeDecl: rlim_t, []
IdentifierType: ['int']
Typedef: sa_family_t, [], ['typedef']
TypeDecl: sa_family_t, []
IdentifierType: ['int']
Typedef: sigjmp_buf, [], ['typedef']
TypeDecl: sigjmp_buf, []
IdentifierType: ['int']
Typedef: stack_t, [], ['typedef']
TypeDecl: stack_t, []
IdentifierType: ['int']
Typedef: siginfo_t, [], ['typedef']
TypeDecl: siginfo_t, []
IdentifierType: ['int']
Typedef: z_stream, [], ['typedef']
TypeDecl: z_stream, []
IdentifierType: ['int']
Typedef: int8_t, [], ['typedef']
TypeDecl: int8_t, []
IdentifierType: ['int']
Typedef: uint8_t, [], ['typedef']
TypeDecl: uint8_t, []
IdentifierType: ['int']
Typedef: int16_t, [], ['typedef']
TypeDecl: int16_t, []
IdentifierType: ['int']
Typedef: uint16_t, [], ['typedef']
TypeDecl: uint16_t, []
IdentifierType: ['int']
Typedef: int32_t, [], ['typedef']
TypeDecl: int32_t, []
IdentifierType: ['int']
Typedef: uint32_t, [], ['typedef']
TypeDecl: uint32_t, []
IdentifierType: ['int']
Typedef: int64_t, [], ['typedef']
TypeDecl: int64_t, []
IdentifierType: ['int']
Typedef: uint64_t, [], ['typedef']
TypeDecl: uint64_t, []
IdentifierType: ['int']
Typedef: int_least8_t, [], ['typedef']
TypeDecl: int_least8_t, []
IdentifierType: ['int']
Typedef: uint_least8_t, [], ['typedef']
TypeDecl: uint_least8_t, []
IdentifierType: ['int']
Typedef: int_least16_t, [], ['typedef']
TypeDecl: int_least16_t, []
IdentifierType: ['int']
Typedef: uint_least16_t, [], ['typedef']
TypeDecl: uint_least16_t, []
IdentifierType: ['int']
Typedef: int_least32_t, [], ['typedef']
TypeDecl: int_least32_t, []
IdentifierType: ['int']
Typedef: uint_least32_t, [], ['typedef']
TypeDecl: uint_least32_t, []
IdentifierType: ['int']
Typedef: int_least64_t, [], ['typedef']
TypeDecl: int_least64_t, []
IdentifierType: ['int']
Typedef: uint_least64_t, [], ['typedef']
TypeDecl: uint_least64_t, []
IdentifierType: ['int']
Typedef: int_fast8_t, [], ['typedef']
TypeDecl: int_fast8_t, []
IdentifierType: ['int']
Typedef: uint_fast8_t, [], ['typedef']
TypeDecl: uint_fast8_t, []
IdentifierType: ['int']
Typedef: int_fast16_t, [], ['typedef']
TypeDecl: int_fast16_t, []
IdentifierType: ['int']
Typedef: uint_fast16_t, [], ['typedef']
TypeDecl: uint_fast16_t, []
IdentifierType: ['int']
Typedef: int_fast32_t, [], ['typedef']
TypeDecl: int_fast32_t, []
IdentifierType: ['int']
Typedef: uint_fast32_t, [], ['typedef']
TypeDecl: uint_fast32_t, []
IdentifierType: ['int']
Typedef: int_fast64_t, [], ['typedef']
TypeDecl: int_fast64_t, []
IdentifierType: ['int']
Typedef: uint_fast64_t, [], ['typedef']
TypeDecl: uint_fast64_t, []
IdentifierType: ['int']
Typedef: intptr_t, [], ['typedef']
TypeDecl: intptr_t, []
IdentifierType: ['int']
Typedef: uintptr_t, [], ['typedef']
TypeDecl: uintptr_t, []
IdentifierType: ['int']
Typedef: intmax_t, [], ['typedef']
TypeDecl: intmax_t, []
IdentifierType: ['int']
Typedef: uintmax_t, [], ['typedef']
TypeDecl: uintmax_t, []
IdentifierType: ['int']
Typedef: bool, [], ['typedef']
TypeDecl: bool, []
IdentifierType: ['_Bool']
Typedef: MirEGLNativeWindowType, [], ['typedef']
PtrDecl: []
TypeDecl: MirEGLNativeWindowType, []
IdentifierType: ['void']
Typedef: MirEGLNativeDisplayType, [], ['typedef']
PtrDecl: []
TypeDecl: MirEGLNativeDisplayType, []
IdentifierType: ['void']
Typedef: MirConnection, [], ['typedef']
TypeDecl: MirConnection, []
Struct: MirConnection
Typedef: MirSurface, [], ['typedef']
TypeDecl: MirSurface, []
Struct: MirSurface
Typedef: MirSurfaceSpec, [], ['typedef']
TypeDecl: MirSurfaceSpec, []
Struct: MirSurfaceSpec
Typedef: MirScreencast, [], ['typedef']
TypeDecl: MirScreencast, []
Struct: MirScreencast
Typedef: MirPromptSession, [], ['typedef']
TypeDecl: MirPromptSession, []
Struct: MirPromptSession
Typedef: MirBufferStream, [], ['typedef']
TypeDecl: MirBufferStream, []
Struct: MirBufferStream
Typedef: MirPersistentId, [], ['typedef']
TypeDecl: MirPersistentId, []
Struct: MirPersistentId
Typedef: MirBlob, [], ['typedef']
TypeDecl: MirBlob, []
Struct: MirBlob
Typedef: MirDisplayConfig, [], ['typedef']
TypeDecl: MirDisplayConfig, []
Struct: MirDisplayConfig
Typedef: xcb_connection_t, [], ['typedef']
TypeDecl: xcb_connection_t, []
Struct: xcb_connection_t
Typedef: xcb_window_t, [], ['typedef']
TypeDecl: xcb_window_t, []
IdentifierType: ['uint32_t']
Typedef: xcb_visualid_t, [], ['typedef']
TypeDecl: xcb_visualid_t, []
IdentifierType: ['uint32_t']
FuncDef:
Decl: main, [], [], []
FuncDecl:
TypeDecl: main, []
IdentifierType: ['int']
Compound:
Decl: number1, [], [], []
TypeDecl: number1, []
IdentifierType: ['int']
Decl: number2, [], [], []
TypeDecl: number2, []
IdentifierType: ['int']
FuncCall:
ID: printf
ExprList:
Constant: string, "Enter two integers: "
FuncCall:
ID: scanf
ExprList:
Constant: string, "%d %d"
UnaryOp: &
ID: number1
UnaryOp: &
ID: number2
If:
BinaryOp: >=
ID: number1
ID: number2
Compound:
If:
BinaryOp: ==
ID: number1
ID: number2
Compound:
FuncCall:
ID: printf
ExprList:
Constant: string, "Result: %d = %d"
ID: number1
ID: number2
Compound:
FuncCall:
ID: printf
ExprList:
Constant: string, "Result: %d > %d"
ID: number1
ID: number2
Compound:
FuncCall:
ID: printf
ExprList:
Constant: string, "Result: %d < %d"
ID: number1
ID: number2
Return:
Constant: int, 0
最佳答案
这看起来像一个正确的 AST。顶部的所有 Typedef
节点都来自 pycparser 的“假” header ,以帮助它正确解析文件,您几乎可以忽略它们。
AST 只是一个递归的节点树;每个节点都是一个 Node目的。您可以迭代它的子节点(其他节点),使用 .coord
属性查看其原始源位置,等等。有几个查看 AST 节点的示例,例如 explore_ast .
要查找特定节点,您可能需要编写访问者。有几个这样做的例子,比如 func_calls .
关于c - pycparser AST 节点指针/位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54717008/
我正在使用 JavaFX 8 创建一个应用程序。我使用拖/放动态更改网格 Pane 的内容。我希望每行或每行/列迭代 GridPane 内容。JavaFX 允许通过指定行和列在 GridPane 中添
我正在尝试将图像拖放到div上。图像没有被拖到div上并给出以下错误 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': pa
我正在 android studio 中创建内部构建 AR 导航。我正在寻找一种方法将 anchor 与其他 anchor 或 anchor 节点/节点“连接”起来。我不确定使用哪一个。基于我将强制用
我在 Hive 上运行一些作业:首先是 4 节点,然后是 2 节点。令我惊讶的是,我的 2 节点性能比我的 4 节点更好。 首先,我在一个 4 节点(4 个事件节点)上运行查询,然后关闭 2 个节点(
我有 Node* current ,我在其中存储指向列表“顶部”当前节点的指针。当我将一个新节点设置为当前节点时,出现错误: '=' : cannot convert from 'CircularDo
我是 dcos Mesos 的新手,在本地 Ubuntu 机器上安装了 dc os。 我可以查看 dcos 仪表板。 但我无法使用 dcos node ssh --master-proxy --lea
在 JavaFX 中,是否有类似 setLayout(); 的东西?或 setBounds(); ? 例如,我想将按钮定位到我想要的位置。 最佳答案 JavaFX 场景图上的所有内容都是 Node .
我正在开发一个 JavaFX 应用程序,其中我开发的类(从 javafx.scene.Parent 扩展)是根据用户在 ListView 控件中单击的条目动态创建的。 只是要清楚这个节点,它不是使用像
我正在尝试为节点-边缘关系创建一个类图,因为它可以在有向图中找到。我想传达的是,Nodes 引用了 Edges,Edges 也引用了 Nodes。每个 Edge 都恰好需要两个 Node(源和目标)。
在mapreduce作业期间,单个任务将在随机节点上运行,是否有任何方法限制应在其中运行任务的节点? 最佳答案 Hadoop不会选择节点来随机运行任务。考虑到数据局部性,否则将有很多网络开销。 任务与
有什么区别: a) nodetool 重建 b) nodetool 修复 [-pr] 换句话来说,各个命令到底是做什么的? 最佳答案 nodetool重建:类似于引导过程(当您向集群添加新节点时),但
我已将第一个 OneToMany 关系添加到我的 hibernate 3.6.10 项目中。这是一个类: /** * */ package com.heavyweightsoftware.leal
是否有可能找到正在监听触发当前函数的事件的元素? 在下面的代码中,event.target 返回 #xScrollPane 和 event.currentTarget 和 event 的最低子节点.f
我正在尝试覆盖我数据库中的一些数据。结构很简单,就是: recipes { user_1{ recipe_1{data} recipe_2{data} } user_2{
我使用 setInterval 来运行该函数,但它会多次执行函数 2... 如何在输入中插入一个值后执行函数 第一个输入与其余输入的距离不同 如何在插入 val(tab 选项)后将插入从 1 个输入移
我不知道代码有什么问题,但在 visual studio 中不断收到这些错误消息。 Error 18 error C1903: unable to recover from previous e
我正在尝试从其类中获取 SharePoint 搜索导航节点的对象。 var nodes = $("div.ms-qSuggest-listItem"); 我正在获取节点对象,现在想要获取“_promp
D:\nodeP>node main.js module.js:327 抛出错误; ^ 错误:在 Function.Module 的 Function.Module._resolveFilename
struct node{ int key, prior, cnt, val; node *l, *r; node(){} node(int nkey) : key(nkey),
我有以下代码使用迭代器将项目插入双链表。这就是我们被要求这样做的方式。代码有效,但问题是我有 24 字节的绝对内存泄漏。 NodeIterator insert(NodeIterator & itrP
我是一名优秀的程序员,十分优秀!