首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ANTLR postscript树

ANTLR postscript树
EN

Stack Overflow用户
提问于 2013-02-17 04:50:38
回答 1查看 298关注 0票数 0

使用antlr4 TestRig,您可以使用-ps生成PostScript树。我看不到我的树。

PostScript:

代码语言:javascript
复制
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 54 48

0.3 setlinewidth
%% x y w h highlight
/highlight {
        4 dict begin
        /h exch def
        /w exch def
        /y exch def
        /x exch def
        gsave
        newpath
        x y moveto
        0 h rlineto     % up to left corner
        w 0 rlineto     % to upper right corner
        0 h neg rlineto % to lower right corner
        w neg 0 rlineto % back home to lower left corner
        closepath
        .95 .83 .82 setrgbcolor
        fill
        grestore
        end
} def
/ArialMT findfont 11 scalefont setfont
27,662 32,395 moveto
12,616 15,395 lineto
27,662 32,395 moveto
42,709 15,395 lineto
25,831 37,395 moveto
(r) show
stroke
1,000 5,000 moveto
(hello) show
stroke
33,232 5,000 moveto
(part) show
stroke
%%Trailer

GhostView中的错误:

代码语言:javascript
复制
GSview 5.0 2012-01-17
Unknown in Prolog section at line 5:
  %% x y w h highlight


GPL Ghostscript 9.07 (2013-02-14)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Displaying DSC file C:/develop/libro/test/arbol.ps without pages
Scanning c:\psfonts for fonts... 0 files, 0 scanned, 0 new fonts.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 3168784 1824261 3249480 1962181 2 done.
Error: /undefined in 27,662
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   false   1   %stopped_push   1932   1   3   %oparray_pop   1931   1   3   %oparray_pop   1915   1   3   %oparray_pop   1803   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1182/1684(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--
Current allocation mode is local
Last OS error: No such file or directory

--- Begin offending input ---
0.3 setlinewidth
%% x y w h highlight
/highlight {
        4 dict begin
        /h exch def
        /w exch def
        /y exch def
        /x exch def
        gsave
        newpath
        x y moveto
        0 h rlineto     % up to left corner
        w 0 rlineto     % to upper right corner
        0 h neg rlineto % to lower right corner
        w neg 0 rlineto % back home to lower left corner
        closepath
        .95 .83 .82 setrgbcolor
        fill
        grestore
        end
} def
/ArialMT findfont 11 scalefont setfont
27,662 32,395 moveto
12,616 15,395 lineto
27,662 32,395 moveto
42,709 15,395 lineto
25,831 37,395 moveto
(r) show
stroke
1,000 5,000 moveto
(hello) show
stroke
33,232 5,000 moveto
(part) show
stroke

--- End offending input ---
file offset = 784
gsapi_run_string_continue returns -101
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-17 06:44:15

Bon,c‘’est bien simple,il semble que ANTLR 4 génère les chiffres en fonction de la locale,c‘’està-dire,en français : avec une virgule。Et c‘’est dommage,parce dans ce cas,PostScript‘’en trave que dalle.

你的问题的解决方案很简单。似乎ANTLR4使用区域设置生成数字,例如,在法语中,使用逗号。很遗憾,因为PostScript不懂法语(拉丁语?)浮点数。

在Unix上,您可以临时更改bash上的区域设置

代码语言:javascript
复制
export LANG=C
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14914962

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档