Lemon解析器作为Xcode构建规则 [英] Lemon parser as Xcode build rule

查看:100
本文介绍了Lemon解析器作为Xcode构建规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在集成为使用脚本的Yacc源文件" 的Xcode中使用Lemon解析器时,柠檬生成的警告不会显示在Xcode警告部分.

When using lemon parser in Xcode integrated as 'Yacc source file using Script', warnings generated by lemon don't show up in the Xcode warning section.

推荐答案

柠檬警告输出与Xcode期望的格式不兼容. Lemon输出的格式如下:

The lemon warning output is not compatible with the format expected by Xcode. Lemon output is formatted like this:

filename.y:NR: message

注意:Lemon似乎在其警告输出中将文件名限制为20个字符.

Note: Lemon also seems to limit the filename to 20 characters in its warning output.

Xcode期望:

path:NR: warning: message

这可以通过awk lemon $INPUT_FILE_BASE.y | awk -F ': ' -v base="${BASE}" '{ print base "/" $1 ": warning: " $2}'

这是我完整的脚本:

LEMON=$(printf %q "$BUILT_PRODUCTS_DIR/lemon")
LEMPAR=$(printf %q "$SRCROOT/../Vendor/lemon/lempar.c")
BASE=$(dirname "$INPUT_FILE_PATH.y")

cd $DERIVED_FILES_DIR
cp $INPUT_FILE_PATH $INPUT_FILE_BASE.y
cp $LEMPAR $DERIVED_FILES_DIR/lempar.c
$LEMON $INPUT_FILE_BASE.y | awk -F ': ' -v base="${BASE}" '{ print base "/" $1 ": warning: " $2}'

mv $INPUT_FILE_BASE.c $INPUT_FILE_BASE.m

Xcode 使用脚本的Yacc源文件" :

警告现在也显示在gramma文件中:

Warnings are also shown inline in the gramma file now:

这篇关于Lemon解析器作为Xcode构建规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆