Source code: jpicedt/format/pstricks/parser/BeginPsPictureExpression.java
1 /* jPicEdt version 1.3.2, a picture editor for LaTeX.
2 Copyright (C) 1999-2002 Sylvain Reynal
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 Sylvain Reynal
19 Département de Physique
20 Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA)
21 6, avenue du Ponceau
22 95014 CERGY CEDEX
23 FRANCE
24
25 Tel : 00 +33 130 736 245
26 Fax : 00 +33 130 736 667
27 e-mail : reynal@ensea.fr
28 jPicEdt web page : http://www.jpicedt.org
29 */
30
31 package jpicedt.format.pstricks.parser;
32
33 import jpicedt.graphic.io.parser.*;
34
35 /**
36 * \begin{pspicture}(x0,y0)(x1,y1) -> defines a box with BL=(x0,y0) and TR=(x1,y1)<br>
37 * \begin{pspicture}*(x0,y0)(x1,y1) -> clipped<br>
38 * \begin{pspicture}[baseline](x0,y0)(x1,y1) -> changes baseline (see pstricks's doc p.41)<br>
39 * \begin{pspicture}[](x0,y0)(x1,y1) -> baseline passes across the origine<br>
40 * And the same commands with \pspicture (that is, TeX-like).<br>
41 * @author $Author: reynal $
42 * @version $Id: BeginPsPictureExpression.java,v 1.2 2002/08/05 16:44:10 reynal Exp $
43 */
44 public class BeginPsPictureExpression extends SequenceExpression implements ExpressionConstants {
45
46 public BeginPsPictureExpression(){
47
48 super(true); // throw IncompleteSequence Exception
49 add(new AlternateExpression(
50 new LiteralExpression("\\pspicture"),
51 new LiteralExpression("\\begin{pspicture}")));
52 add(new OptionalExpression(new LiteralExpression("*"))); // clipped ?
53 add(WHITE_SPACES_OR_EOL);
54 add(new OptionalExpression(new AlternateExpression(
55 new LiteralExpression("[]"), // "[]" (default baseline)
56 new SequenceExpression(
57 new LiteralExpression("["), // "[baseline]"
58 new NumericalExpression(DOUBLE, POSITIVE, "]", true),true),
59 WHITE_SPACES_OR_EOL)));
60 add(new PicPointExpression("(", ",", ")")); // BL corner
61 add(WHITE_SPACES_OR_EOL);
62 add(new PicPointExpression("(", ",", ")")); // TR corner
63 }
64
65 public String toString(){
66 return "[BeginPsPictureExpression]";
67 }
68 }