我正在研究一个shell,一个像bash一样的小shell,没有脚本(如果......)我必须手工制作lexer/parser(LL).
因此词法分析器会将命令(char*cmd)转换为链表(t_list*list).LL解析器将链接列表(t_list*list)转换为带有语法的AST(二叉树t_btree*root)
所以,我知道如何制作LL解析器,但我不知道如何标记我的命令.
例如: ps | grep ls >> file ; make && ./a.out
=> 'ps' '|' 'grep' 'ls' '>>' 'file' ';' ''make '&&' './a.out'
谢谢.
(我不想使用任何发电机)
我有一个支持多种语言环境的 opengraph 对象(在本例中,默认为 en_US 和 fr_FR)。
这是 facebook opengraph 使用的生成 html 页面的示例,但是当我自己调用它时。
Default:
<meta property="og:locale" content="en_US"/>
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:title" content="chair" />
?fb_locale=en_US
<meta property="og:locale" content="en_US"/>
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:title" content="chair" />
?fb_locale=fr_FR
<meta property="og:locale" content="fr_FR"/>
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:title" content="chaise" />
Run Code Online (Sandbox Code Playgroud)
Facebook 爬虫既不发送 fb_locale 也不发送 X-Facebook-Locale。
解决方法: 刷新facebook的缓存
curl -X POST -F "id=http://yoururl" -F "scrape=true" -F "locale=fr_fr" "https://graph.facebook.com" -s
Run Code Online (Sandbox Code Playgroud)
(在我的例子中,我使用了 fr_fr)
我在php中创建了一个函数来转换字符串,如:
[20110911, 20110913, [20110915, 20110918], 20110920, 20110922, 20110924, [20110926, 20110927], 20110929]
Run Code Online (Sandbox Code Playgroud)
到php数组像:
Array
(
[0] => 20110911
[1] => 20110913
[2] => Array
(
[0] => 20110915
[1] => 20110918
)
[3] => 20110920
[4] => 20110922
[5] => 20110924
[6] => Array
(
[0] => 20110926
[1] => 20110927
)
[7] => 20110929
[8] => Array
(
[0] => 20111001
[1] => 20111002
)
[9] => 20111004
[10] => Array
(
[0] => 20111006
[1] => 20111007
)
) …Run Code Online (Sandbox Code Playgroud)