找到一个非常好用的Css Parser,和大家分享
2010-12-03 10:28
405 查看
是C#写的
原文地址:http://www.codeproject.com/KB/recipes/CSSParser.aspx
原文地址:http://www.codeproject.com/KB/recipes/CSSParser.aspx
A Quick Note on the Downloads
If you have previously seen this article, the v2 downloads contain a complete rewrite of the parser, which required a completely new model. The v1 downloads are provided for those who are dependant on the previous model (the v1 parser was last updated on 11/25/2008). If this is the first time you are seeing this article, use the v2 downloads that this article now describes.Introduction
My motivation for this project came from an interest in importing color information. I needed to import from CSS files into an application I was working on for managing color sets of Web and other projects. However, on import I didn't just want the color, but the elements it is associated with as well. So, Regex was out. This left me with the need for a full CSS parser that could be used for lots of things, not just my nutty little color manager. So all I need is a grammar that describes the structure of the CSS 2.1 language. Unfortunately, the only grammar definition for CSS I could find was the W3C grammar written for Lex/Yacc. Due to my inexperience with Yacc, and my apathy towards learning it, I had to write a grammar from scratch. Ultimately, I chose to write a Coco/R attributed grammar. With version 2, the parser is now based on the 2.1 spec, with support for some 3.0 elements. Because it now handles "@" rules generically, most browser specific extensions should also now be supported. The object model was changed completely for the 2nd version of this parser. Hopefully this will cover most uses you may have for a CSS parser. If you have further requirements, it may be a good base to work from.Parsers
I don't claim to be an expert in the fine arts of deterministic finite automaton. Having said that, the basic concept of parsing text, interpreting the contents and building some useful result from it can be understood without a deep understanding of the nitty gritty of how it is accomplished. When working with a parser generator like Coco, it's important to understand the basic concepts.相关文章推荐
- 发现一个非常好用的前端js自动补全插件,分享给大家(false)
- 网上找到的一个iframe标签的运用 与大家分享
- 从网上找到一个清晰CSS视频教程和大家分享一下
- 一次偶然机遇找到一个不错的关于Android实现加载gif动画的实例,写一下分享个大家。
- 用excel做一个家庭流水账本 增加一些统计功能 和大家分享
- 非常好的学习网站,分享给大家
- 记录一个图片处理类,分享给大家参考
- 今天写了一个webservice的loadrunner脚步和大家分享一下
- 最近学习框架做了一个小网站,基本功能都实现了但是分页没办法用框架思想实现,查了资料找到一个不错的,修改了下分享下
- 一个从业10年的程序员,给程序员小弟弟小妹妹们的几点忠告(从VeryCD上看到的评论,分享给大家)
- 分享给大家一个生成图形验证码的View
- 大家工作还好吗?分享一个信息:主架构师
- 偶然看到一个GridView的妙用,感觉很好,转载过来和大家分享下,很感谢博主
- 分享给大家一篇励志大师的文章-->一个男人关心的东西,决定了他的层次!
- 一个分析很透彻的strust2流程分享给大家
- 给大家分享一个通用PAGE类
- 10.1我发现一个非常好的架构NHibernate,我想和大家一起研究
- 和大家分享一个Makefile的通用写法
- 分享一个android 访问http的类,非常好用哦
- 一个PHP的QRcode类,与大家分享