summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/analysisparser.tac
blob: 4b42b9908abc3ee268774761ecd31843948b40f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%{
%}

#include numeric.tin
#include string.tin

%start command

%token CLEAR_
%token LOAD_
%token MESSAGE_
%token PLOT_
%token STDIN_
%token TASK_
%token TEXT_

%token OK_
%token OKCANCEL_
%token RETRYCANCEL_
%token YESNO_
%token YESNOCANCEL_

%token XY_
%token XYEX_
%token XYEY_
%token XYEXEY_

%%

#include numeric.trl

command : analysis 
 | analysis {yyclearin; YYACCEPT} STRING_
 ;

analysis : INT_ {AnalysisTask $1 menu}
 | TASK_ task
 | LOAD_ load
 | CLEAR_ clear
 | TEXT_ text
 | PLOT_ plot
 | STRING_ {ProcessAnalysisFile $1}
 | MESSAGE_ message STRING_ {AnalysisMessage $2 $3}
 ;

load : {AnalysisCmdLoad}
 | STRING_ {ProcessAnalysisFile $1}
 ;

task : INT_ {AnalysisTask $1 menu}
 | STRING_ {AnalysisCmdTask $1}
 ;

clear : {ClearAnalysis}
 | LOAD_ clearLoad
 ;
 
clearLoad : {ClearAnalysis; AnalysisCmdLoad}
 | STRING_ {ClearAnalysis; ProcessAnalysisFile $1}
 ;

message : {set _ ok}
 | OK_ {set _ ok}
 | OKCANCEL_ {set _ okcancel}
 | RETRYCANCEL_ {set _ retrycancel}
 | YESNO_ {set _ yesno}
 | YESNOCANCEL_ {set _ yesnocancel}
 ;

text : {AnalysisCmdText}
 | STRING_ {AnalysisText apXPA Analysis $1 append}
 ;
 
plot : STDIN_ {AnalysisCmdPlotStdin}
 | STRING_ STRING_ STRING_ dim {AnalysisCmdPlotLine $1 $2 $3 $4}
 ;

dim : XY_ {set _ xy}
 | XYEX_ {set _ xyex}
 | XYEY_ {set _ xyey}
 | XYEXEY_ {set _ xyexey}
 | INT_ {set _ $1}
 ;

%%

proc analysis::yyerror {msg} {
     variable yycnt
     variable yy_current_buffer
     variable index_

     ParserError $msg $yycnt $yy_current_buffer $index_
}