在哪里可以找到Webkit的CSS语法文件? [英] Where can I find Webkit's CSS grammar files?

查看:104
本文介绍了在哪里可以找到Webkit的CSS语法文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与HTML不同,CSS是> 上下文无关语法 .语法语法通常在 BNF 中进行描述或 EBNF 表示法.

Unlike HTML, CSS is a context free grammar. Syntax grammar is usually described in BNF or EBNF notation.

根据> 塔利·加西尔 的Articke 浏览器的工作方式 ,WebKit使用 Flex和Bison 解析器生成器,可以从CSS语法文件自动创建解析器.

According to Tali Garsiel's articke How Browsers Work, WebKit uses Flex and Bison parser generators to create parsers automatically from CSS grammar files.

由于Webkit是一个开源项目,我希望这些语法文件可以在 它的某个位置中找到源代码 .不过,我一直找不到.有人可以帮我吗?

As Webkit is an open source project, I would expect these grammar files can be found somewhere in its source code. I haven't been able to find it, though. Can anyone help me out here?

注释1:

询问> 浏览器的运行方式解析/渲染CSS / 浏览器的方式阅读和解释CSS !!

I'm NOT asking how browsers parse/render CSS / how browsers read and interpret CSS!!

我已经知道了.实际上,在上述文章 浏览器的操作方式工作 .所以不,它不是该问题的重复.

I know that already. In fact, it's explained pretty well in the aforementioned article How Browsers Work. So no, it's not a duplicate of that question.

我正在寻找的是Webkit用来解析/渲染CSS的特定CSS语法文件,我在任何地方都找不到.

What I'm looking for, is the specific CSS grammar files that Webkit uses to parse/render CSS, which I haven't been able to find anywhere.

注释2:

我也是,根本不要求任何人推荐或查找书籍,工具,软件库,教程或其他非现场....

I'm also NOT asking anyone to recommend or find a book, tool, software library, tutorial or other off-site... at all.

我只是想问在哪里可以找到Webkit用来解析CSS的文件,因为我自己无法找到它们.

I'm just asking for where to find some files that Webkit uses (or used) for parsing CSS, because I've been unable to find them myself.

注释3:

我问这个问题是因为我正在寻找一种解析CSS的便捷方法.我想以浏览器解析CSS的方式为基础(更具体地讲=通过分析Webkit浏览器的解析方式).

I'm asking this because I'm looking for a convenient way to parse CSS. I want to base this approach on the way a browser parses CSS (more specifically = by analysing how it is parsed by Webkit browsers).

是的,这个问题确实是一个编程问题,完全是Stack Overflow上的主题.

So yes, this question really is a programming question and totally on topic here at Stack Overflow.

推荐答案

野牛文件(或至少是其版本)位于css目录中,为 a perl脚本.

The bison file (or at least, a version of it) is in the css directory as CSSGrammar.y.in. That file is preprocessed and then run through bison using a perl script.

显然,Flex扫描仪是在2011/12年重写的;请参见此 webkit错误.手动扫描器是 CSSParser.cpp 的一部分

Apparently the flex scanner was rewritten in 2011/12; see this webkit bug. The handbuilt scanner is part of CSSParser.cpp.

通过回顾git历史记录,您可以找到较旧的版本.例如,在safari-4-branch中,我找到了以下 flex 文件.

By looking back in the git history, you could find older versions. For example, in the safari-4-branch, I found the following bison and flex files.

这篇关于在哪里可以找到Webkit的CSS语法文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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