isac-java/src/java-tests/isac/gui/mawen/editor/TestDATAeditor.scala
author Walther Neuper <wneuper@ist.tugraz.at>
Wed, 02 Aug 2017 09:56:12 +0200
changeset 5190 d3fa6cda3137
parent 5183 a85c7ff660d9
permissions -rw-r--r--
--- adapt BOX of syntax/ to version in editor/

Note: 2 TestCases are still broken
wneuper@5088
     1
package isac.gui.mawen.editor
wneuper@5088
     2
wneuper@5088
     3
import isac.gui.mawen.syntax.Ast._
wneuper@5088
     4
wneuper@5088
     5
object TestDATAeditor {
wneuper@5088
     6
  // xi = 0x03BE.toChar.toString()
wneuper@5088
     7
  def s1 = Variable ("a")
wneuper@5088
     8
  
wneuper@5088
     9
  def s2 = Constant("+")
wneuper@5088
    10
  
wneuper@5088
    11
  def a1 = Appl(List(Constant("+"), Variable ("y"), Variable ("b")))
wneuper@5088
    12
    
wneuper@5088
    13
  def a2 = Appl(List(Constant("+"), Variable ("a"), Appl(List(Constant("+"), Variable ("b"), Variable ("c")))))
wneuper@5088
    14
  
wneuper@5088
    15
  def a3 = Appl(List(Constant("+"), Variable ("a"), Appl(List(Constant("+"), Variable ("i"), Appl(List(Constant("+"), Variable ("y"), Variable ("X")))))))
wneuper@5088
    16
  
wneuper@5088
    17
  // a^b
wneuper@5088
    18
  def e1 = Appl(List(Constant("^"), Variable ("a"), Variable ("b")))
wneuper@5088
    19
  // a^b^c
wneuper@5088
    20
  def e2 = Appl(List(Constant("^"), Variable ("a"), Appl(List(Constant("^"), Variable ("b"), Variable ("c")))))
wneuper@5088
    21
  // a^b^c^d^e
wneuper@5088
    22
  def e3 = Appl(List(Constant("^"), Variable ("a"), Appl(List(Constant("^"), Variable ("b"), Appl(List(Constant("^"), Variable ("c"), Appl(List(Constant("^"), Variable ("d"), Variable ("e")))))))))
wneuper@5088
    23
  // a^(b+c)
wneuper@5088
    24
  def e4 = Appl(List(Constant("^"), Variable("a"), Appl(List(Constant("+"), Variable("b"), Variable("c")))))
wneuper@5088
    25
  // (a+b)^(b+c)
wneuper@5088
    26
  def e5 = Appl(List(Constant("^"), Appl(List(Constant("+"), Variable("a"), Variable("b"))), Appl(List(Constant("+"), Variable("c"), Variable("d")))))
wneuper@5088
    27
  
wneuper@5088
    28
  def f1 = Appl(List(Constant("/"), Variable("a"), Variable("b")))
wneuper@5088
    29
  
wneuper@5088
    30
  def f2 = Appl(List(Constant("/"), Variable("a"), Appl(List(Constant("+"), Variable("b"), Variable("c")))))
wneuper@5088
    31
      
wneuper@5088
    32
  def f3 = Appl(List(Constant("/"), Appl(List(Constant("+"), Variable("b"), Variable("c"))),Variable("a")))
wneuper@5088
    33
  
wneuper@5088
    34
  // a + b/c
wneuper@5088
    35
  def f4 = Appl(List(Constant("+"), Variable("a"), Appl(List(Constant("/"),Variable("b"), Variable("c")))))
wneuper@5088
    36
  //a^b/c
wneuper@5088
    37
  def f5 = Appl(List(Constant("/"), Appl(List(Constant("^"), Variable("a"), Variable("b"))), Variable("c")))
wneuper@5088
    38
  
s1520454056@5101
    39
  // a + (b/(c/d))
s1520454056@5101
    40
  def f6 = 
s1520454056@5101
    41
    Appl(List(
s1520454056@5101
    42
      Constant("Groups.plus_class.plus"),
s1520454056@5101
    43
      Variable("a"),
s1520454056@5101
    44
      Appl(List(
s1520454056@5101
    45
        Constant("Fields.inverse_class.divide"),
s1520454056@5101
    46
        Constant("a"),
s1520454056@5101
    47
        Appl(List(
s1520454056@5101
    48
            Constant("Fields.inverse_class.divide"),
s1520454056@5101
    49
            Variable("a"),
s1520454056@5101
    50
            Variable("a")
s1520454056@5101
    51
        ))
s1520454056@5101
    52
      ))
s1520454056@5101
    53
    ))
s1520454056@5151
    54
    
s1520454056@5151
    55
    
s1520454056@5101
    56
  // a + (a / ( a + ( a / a)))
s1520454056@5101
    57
  def f7 = 
s1520454056@5101
    58
    Appl(List(
s1520454056@5101
    59
      Constant("Groups.plus_class.plus"),
s1520454056@5101
    60
      Variable("a"),
s1520454056@5101
    61
      Appl(List(
s1520454056@5101
    62
        Constant("Fields.inverse_class.divide"),
s1520454056@5101
    63
        Constant("a"),
s1520454056@5101
    64
        Appl(List(
s1520454056@5101
    65
          Constant("Groups.plus_class.plus"),
s1520454056@5101
    66
          Variable("a"),
s1520454056@5101
    67
          Appl(List(
s1520454056@5101
    68
              Constant("Fields.inverse_class.divide"),
s1520454056@5101
    69
              Variable("a"),
s1520454056@5101
    70
              Variable("a")
s1520454056@5101
    71
          ))
s1520454056@5101
    72
        ))
s1520454056@5101
    73
      ))
s1520454056@5101
    74
    ))
s1520454056@5151
    75
  
s1520454056@5151
    76
  def f8  = Appl(List(Constant("GAP"), Constant("CURSOR")))
s1520454056@5101
    77
        
s1520454056@5175
    78
  def f9 = Appl(List(Constant("Simplify.Simplify"), Appl(List(Constant("Groups.plus_class.plus"), Appl(List(Constant("Groups.plus_class.plus"), Variable("1"), Appl(List(Constant("Fields.inverse_class.divide"), Variable("1"), Variable("2"))))), Appl(List(Constant("Fields.inverse_class.divide"), Appl(List(Constant("Groups.plus_class.plus"), Appl(List(Constant("Fields.inverse_class.divide"), Variable("2"), Appl(List(Constant("Groups.plus_class.plus"), Variable("x"), Variable("3"))))), Appl(List(Constant("Fields.inverse_class.divide"), Variable("2"), Appl(List(Constant("Groups.minus_class.minus"), Variable("x"), Variable("3"))))))), Appl(List(Constant("Fields.inverse_class.divide"), Appl(List(Constant("Groups.times_class.times"), Variable("8"), Variable("x"))), Appl(List(Constant("Groups.minus_class.minus"), Appl(List(Constant("Power.power_class.power"), Variable("x"), Variable("2"))), Variable("9")))))))))))
wneuper@5088
    79
  
wneuper@5088
    80
  /*
wneuper@5088
    81
   * Examples for reference from UC "User guidance by marked subterms and fill-in-gaps".
wneuper@5088
    82
   * Asts copied from ScalaAstFromString#test_create_Editor_UC
wneuper@5088
    83
   * and adorned with BOXes, GAPs and CURSOR position.
wneuper@5088
    84
   */
wneuper@5088
    85
  def box_05 =
wneuper@5088
    86
    Appl(List(
wneuper@5088
    87
      Constant("Groups.plus_class.plus"),
wneuper@5088
    88
      Appl(List(
wneuper@5088
    89
        Constant("Diff.d_d"),
wneuper@5088
    90
        Variable("x"),
wneuper@5088
    91
        Variable("x"))),
wneuper@5088
    92
      Appl(List(
wneuper@5088
    93
        Constant("Diff.d_d"),
wneuper@5088
    94
        Variable("x"),
wneuper@5088
    95
        Appl(List(               // added to test_create_..
wneuper@5190
    96
          Constant("BOX.1"),     // added, fixes the colour within this group of formulas
wneuper@5088
    97
          Appl(List(
wneuper@5088
    98
            Constant("Transcendental.sin"),
wneuper@5088
    99
            Appl(List(           //added to test_create_..
wneuper@5190
   100
              Constant("BOX.2"), // added, fixes the colour within this group of formulas
wneuper@5088
   101
              Appl(List(
wneuper@5088
   102
                Constant("Power.power_class.power"),
wneuper@5088
   103
                Variable("x"),
wneuper@5088
   104
                Variable("2")))))))))))))
wneuper@5088
   105
wneuper@5088
   106
  def box_06 =
wneuper@5088
   107
    Appl(List(
wneuper@5088
   108
      Constant("HOL.eq"),
wneuper@5088
   109
      Appl(List(
wneuper@5088
   110
        Constant("Diff.d_d"),
wneuper@5088
   111
        Variable("bdv"),
wneuper@5088
   112
        Appl(List(               //added to test_create_..
wneuper@5190
   113
          Constant("BOX.1"),     //added, fixes the colour within this group of formulas
wneuper@5088
   114
          Appl(List(
wneuper@5088
   115
            Constant("Transcendental.sin"),
wneuper@5088
   116
            Appl(List(           //added to test_create_..
wneuper@5190
   117
              Constant("BOX.2"), //added, fixes another colour within this group of formulas
wneuper@5088
   118
             Variable("u"))))))))),
wneuper@5088
   119
      Appl(List(
wneuper@5088
   120
        Constant("Groups.times_class.times"),
wneuper@5088
   121
        Appl(List(               //added to test_create_..
wneuper@5190
   122
          Constant("BOX.11"),    //added, fixes the colour within this group of formulas
wneuper@5088
   123
          Appl(List(
wneuper@5088
   124
            Constant("Transcendental.cos"),
wneuper@5088
   125
            Variable("u"))))),
wneuper@5088
   126
        Appl(List(
wneuper@5088
   127
          Constant("Diff.d_d"),
wneuper@5088
   128
          Variable("bdv"),
wneuper@5088
   129
          Appl(List(             //added to test_create_..
wneuper@5190
   130
            Constant("BOX.12"),  //added, fixes another colour within this group of formulas
wneuper@5088
   131
            Variable("u")))))))))
wneuper@5088
   132
wneuper@5088
   133
  //here the CURSOR coincides with a GAP and a BOX
wneuper@5088
   134
  def box_07_with_cursor =
wneuper@5088
   135
    Appl(List(
wneuper@5088
   136
      Constant("Groups.plus_class.plus"),
wneuper@5088
   137
      Appl(List(Constant("Diff.d_d"),
wneuper@5088
   138
        Variable("x"),
wneuper@5088
   139
        Variable("x"))),
wneuper@5088
   140
      Appl(List(
wneuper@5088
   141
        Constant("Groups.times_class.times"),
wneuper@5088
   142
        Appl(List(               //added to test_create_..
wneuper@5190
   143
          Constant("BOX.11"),    //added, fixes the colour within this group of formulas
wneuper@5088
   144
          Appl(List(
wneuper@5088
   145
            Constant("Transcendental.cos"),
wneuper@5088
   146
            Appl(List(
wneuper@5088
   147
              Constant("Power.power_class.power"),
wneuper@5088
   148
              Variable("x"),
wneuper@5088
   149
              Variable("2"))))))),
wneuper@5088
   150
        Appl(List(
wneuper@5088
   151
          Constant("Diff.d_d"),
wneuper@5088
   152
          Variable("x"),
wneuper@5088
   153
          Appl(List(             //added to test_create_..
wneuper@5190
   154
            Constant("BOX.12"),  //added, fixes another colour within this group of formulas
wneuper@5088
   155
            Appl(List(
wneuper@5088
   156
              Constant("CURSOR"),
wneuper@5088
   157
              Constant("GAP")))))))))))
wneuper@5088
   158
wneuper@5143
   159
  /*------- CURSOR can be in front of an ast or after an ast;
wneuper@5143
   160
   * the latter happens during input beginning with empty formula.
wneuper@5143
   161
   * Example formula "a + (b + c)/(d + e)
wneuper@5143
   162
   */
wneuper@5143
   163
  def cursor_before_fraction = 
wneuper@5143
   164
    Appl(List(
wneuper@5143
   165
      Constant("Groups.plus_class.plus"),
wneuper@5143
   166
      Variable("a"),
wneuper@5143
   167
      Appl(List(                                 //++
wneuper@5143
   168
        Constant("CURSOR"),                      //++
wneuper@5143
   169
        Appl(List(
wneuper@5143
   170
          Constant("Fields.inverse_class.divide"),
wneuper@5143
   171
          Appl(List(
wneuper@5143
   172
            Constant("Groups.plus_class.plus"),
wneuper@5143
   173
            Variable("b"),
wneuper@5143
   174
            Variable("c"))),
wneuper@5143
   175
          Appl(List(
wneuper@5143
   176
            Constant("Groups.plus_class.plus"),
wneuper@5143
   177
            Variable("d"),
wneuper@5143
   178
            Variable("e")))
wneuper@5143
   179
          ))                                     //++
wneuper@5143
   180
      ))))
wneuper@5143
   181
  def cursor_before_numerator = 
wneuper@5143
   182
    Appl(List(
wneuper@5143
   183
      Constant("Groups.plus_class.plus"),
wneuper@5143
   184
      Variable("a"),
wneuper@5143
   185
      Appl(List(
wneuper@5143
   186
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   187
        Appl(List(                                 //++
wneuper@5143
   188
          Constant("CURSOR"),                      //++
wneuper@5143
   189
          Appl(List(
wneuper@5143
   190
            Constant("Groups.plus_class.plus"),
wneuper@5143
   191
            Variable("b"),
wneuper@5143
   192
            Variable("c")))
wneuper@5143
   193
          )),                                      //++
wneuper@5143
   194
        Appl(List(
wneuper@5143
   195
          Constant("Groups.plus_class.plus"),
wneuper@5143
   196
          Variable("d"),
wneuper@5143
   197
          Variable("e")))
wneuper@5143
   198
      ))))
wneuper@5143
   199
  // here the denominator could be extended
wneuper@5143
   200
  def cursor_after_denominator = 
wneuper@5143
   201
    Appl(List(
wneuper@5143
   202
      Constant("Groups.plus_class.plus"),
wneuper@5143
   203
      Variable("a"),
wneuper@5143
   204
      Appl(List(
wneuper@5143
   205
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   206
        Appl(List(
wneuper@5143
   207
          Constant("Groups.plus_class.plus"),
wneuper@5143
   208
          Variable("b"),
wneuper@5143
   209
          Variable("c"))),
wneuper@5143
   210
        Appl(List(                                 //++
wneuper@5143
   211
          Appl(List(
wneuper@5143
   212
            Constant("Groups.plus_class.plus"),
wneuper@5143
   213
            Variable("d"),
wneuper@5143
   214
            Variable("e"))),
wneuper@5143
   215
          Constant("CURSOR")                       //++
wneuper@5143
   216
          ))                                       //++
wneuper@5143
   217
      ))))
wneuper@5143
   218
  // transition from cursor_after_denominator to here is usual input procedere
wneuper@5143
   219
  def cursor_after_fraction = 
wneuper@5143
   220
    Appl(List(
wneuper@5143
   221
      Constant("Groups.plus_class.plus"),
wneuper@5143
   222
      Variable("a"),
wneuper@5143
   223
      Appl(List(                                   //++
wneuper@5143
   224
        Appl(List(
wneuper@5143
   225
          Constant("Fields.inverse_class.divide"),
wneuper@5143
   226
          Appl(List(
wneuper@5143
   227
            Constant("Groups.plus_class.plus"),
wneuper@5143
   228
            Variable("b"),
wneuper@5143
   229
            Variable("c"))),
wneuper@5143
   230
          Appl(List(
wneuper@5143
   231
            Constant("Groups.plus_class.plus"),
wneuper@5143
   232
            Variable("d"),
wneuper@5143
   233
            Variable("e"))),
wneuper@5143
   234
        Constant("CURSOR")                         //++
wneuper@5143
   235
          ))                                       //++
wneuper@5143
   236
      ))))
wneuper@5143
   237
wneuper@5088
   238
  //------- some more examples related to BOX, GAP and CURSOR ------
wneuper@5088
   239
  //here the BOX, the GAP and the CURSOR are separated
wneuper@5088
   240
  def box_gap_cursor =
wneuper@5088
   241
    Appl(List(
wneuper@5088
   242
      Constant("Groups.plus_class.plus"),
wneuper@5088
   243
        Appl(List( 
wneuper@5190
   244
          Constant("BOX.1"),      //a BOX containing "a", 1 fixes the colour within this group of formulas
wneuper@5088
   245
          Variable("a"))),
wneuper@5088
   246
      Appl(List(
wneuper@5088
   247
        Constant("Groups.plus_class.plus"),
wneuper@5088
   248
        Constant("GAP"),        //a GAP as an ast
wneuper@5088
   249
        Appl(List(
wneuper@5088
   250
          Constant("CURSOR"),   //the coursor at "c" (at the beginning of the sub-term)
wneuper@5088
   251
          Variable("c")))))))
wneuper@5088
   252
    
wneuper@5088
   253
  //here a BOX with the CURSOR on a GAP as in box_07_with_cursor above
wneuper@5088
   254
  def box_with_cursor_on_gap =
wneuper@5088
   255
        Appl(List( 
wneuper@5190
   256
          Constant("BOX.1"),       // added, fixes the colour within this group of formulas
wneuper@5088
   257
          Appl(List(
wneuper@5088
   258
            Constant("CURSOR"),
wneuper@5088
   259
            Constant("GAP")))))
wneuper@5088
   260
            
wneuper@5088
   261
  /*
wneuper@5088
   262
   * GAPs supporting input of formulas.
wneuper@5088
   263
   * See UC "Input of specific operators is supported by fill-in-gaps."
wneuper@5088
   264
   */
wneuper@5088
   265
  //1(a) input "a + b": input "+" (while starting "a + " should be possible as well)
wneuper@5088
   266
  def in_1a = 
wneuper@5088
   267
    Appl(List(
wneuper@5088
   268
      Constant("Groups.plus_class.plus"),
wneuper@5088
   269
      Constant("GAP"),
wneuper@5088
   270
      Constant("GAP")))
wneuper@5088
   271
    
wneuper@5088
   272
  //1(b) input "b / c" instead of "b" above: start with "/"
wneuper@5088
   273
  def in_1b = 
wneuper@5088
   274
    Appl(List(
wneuper@5088
   275
      Constant("Groups.plus_class.plus"),
wneuper@5088
   276
      Variable("a"),
wneuper@5088
   277
      Appl(List(
wneuper@5088
   278
        Constant("Fields.inverse_class.divide"),
wneuper@5088
   279
        Constant("GAP"),
wneuper@5088
   280
        Constant("GAP")))))
wneuper@5088
   281
wneuper@5088
   282
  //1(c) input "b / c" instead of "b" above: start with "/"
wneuper@5088
   283
  def in_1c = 
wneuper@5088
   284
    Appl(List(
wneuper@5088
   285
      Constant("Groups.plus_class.plus"),
wneuper@5088
   286
      Variable("a"),
wneuper@5088
   287
      Appl(List(
wneuper@5088
   288
        Constant("Fields.inverse_class.divide"),
wneuper@5088
   289
        Variable("b"),
wneuper@5088
   290
        Constant("GAP")))))
wneuper@5088
   291
wneuper@5088
   292
  /* ---------------------------------------------------------------------------------
wneuper@5088
   293
   * nested representation of BOX, CURSOR, GAP
wneuper@5088
   294
   * # BOX, denoted by [ast], where ast is some (sub-)term, 
wneuper@5088
   295
   *   un-boxed  <-->  BOXed
wneuper@5088
   296
   *   ast       <-->  Appl(List(Constant("BOX"), Constant("1"), ast))
wneuper@5088
   297
   *   
wneuper@5190
   298
   *   Scala pattern matching may include in if:
wneuper@5190
   299
   *   with Appl(Constant("BOX.1") :: ast).
wneuper@5190
   300
   *   "1" denotes a colour, "11" a colour similar to "1" (there are at most 2 "similar" colours)
wneuper@5190
   301
   *   TODO: introduce notion of "similar" colours
wneuper@5190
   302
   *   numbers "1".."9" are mapped in <code>editor.Settings.CollorMapping</code>
wneuper@5088
   303
   *   
wneuper@5088
   304
   * # CURSOR, denoted by {ast}, ast is some (sub-)term preceded by the cursor
wneuper@5088
   305
   *   without   <-->  with CURSOR
wneuper@5143
   306
   *   ast       <-->  Appl(List(Constant("CURSOR"), ast))    cursor in front of ast
wneuper@5143
   307
   *   ast       <-->  Appl(List(ast, Constant("CURSOR")))    cursor after the ast
wneuper@5088
   308
   *   
wneuper@5088
   309
   *   The cursor might have a certain size according to the size of ast.
wneuper@5088
   310
   *   
wneuper@5088
   311
   * # GAP, denoted by #
wneuper@5088
   312
   *   without   <-->  replaced by GAP
wneuper@5088
   313
   *   ast       <-->  Constant("GAP")
wneuper@5088
   314
   *   
wneuper@5088
   315
   * Note: CURSOR, GAP as Constant() allows free use of Variable("CURSOR") etc.
wneuper@5088
   316
   */
wneuper@5143
   317
   def nest_BOX_1 = //"[aaa] + bbb", "[]" denotes a box
wneuper@5088
   318
    Appl(List(
wneuper@5088
   319
      Constant("Groups.plus_class.plus"),
wneuper@5088
   320
      Appl(List(
wneuper@5190
   321
        Constant("BOX.1"),
wneuper@5088
   322
        Variable("aaa"))),
wneuper@5088
   323
      Variable("bbb")))
wneuper@5088
   324
  def nest_BOX_2 = //"aaa + [bbb]"
wneuper@5088
   325
    Appl(List(
wneuper@5088
   326
      Constant("Groups.plus_class.plus"),
wneuper@5088
   327
      Variable("aaa"),
wneuper@5088
   328
      Appl(List(
wneuper@5190
   329
        Constant("BOX.1"),
wneuper@5088
   330
        Variable("bbb")))))
wneuper@5088
   331
  def nest_BOX_3 = //"[aaa + bbb]"
wneuper@5088
   332
    Appl(List(
wneuper@5190
   333
      Constant("BOX.1"),
wneuper@5088
   334
        Appl(List(
wneuper@5088
   335
          Constant("Groups.plus_class.plus"),
wneuper@5088
   336
          Variable("aaa"),
wneuper@5088
   337
          Variable("bbb")))))
wneuper@5088
   338
   def nest_BOX_1_CURSOR = //"[{aaa}] + bbb"  the cursor stands at the beginning of "aaa"
wneuper@5088
   339
    Appl(List(
wneuper@5088
   340
      Constant("Groups.plus_class.plus"),
wneuper@5088
   341
      Appl(List(
wneuper@5190
   342
        Constant("BOX.1"),
wneuper@5088
   343
        Appl(List(
wneuper@5088
   344
          Constant("CURSOR"),
wneuper@5088
   345
          Variable("aaa"))))),
wneuper@5088
   346
      Variable("bbb")))
wneuper@5088
   347
   def nest_BOX_1_CURSOR_GAP = //"[{#}] + bbb"
wneuper@5088
   348
    Appl(List(
wneuper@5088
   349
      Constant("Groups.plus_class.plus"),
wneuper@5088
   350
      Appl(List(
wneuper@5190
   351
        Constant("BOX.1"),
wneuper@5088
   352
        Appl(List(
wneuper@5088
   353
          Constant("CURSOR"),
wneuper@5088
   354
          Constant("GAP"))))),
wneuper@5088
   355
      Variable("bbb")))
wneuper@5088
   356
   def nest_BOX_1_CURSOR_b = //"[aaa] + {bbb}"
wneuper@5088
   357
    Appl(List(
wneuper@5088
   358
      Constant("Groups.plus_class.plus"),
wneuper@5088
   359
      Appl(List(
wneuper@5190
   360
        Constant("BOX.1"),
wneuper@5088
   361
        Variable("aaa"))),
wneuper@5088
   362
      Appl(List(
wneuper@5088
   363
        Constant("CURSOR"),
wneuper@5088
   364
        Variable("bbb")))))
wneuper@5088
   365
   /*
wneuper@5088
   366
    *  One and the same code can handle two different behaviours 
wneuper@5088
   367
    *  (according to respective structure of Ast):
wneuper@5088
   368
    *  (1) The cursor stands WITHIN the box, in front of the boxes content.
wneuper@5088
   369
    *      This invites to edit the content of the box ???
wneuper@5088
   370
    *  (2) The cursor stands OUTSIDE, in front of the box.
wneuper@5088
   371
    *      This invites to edit the whole box ???
wneuper@5088
   372
    */
wneuper@5088
   373
  def nest_CURSOR_BOX_3A = //"[{aaa + bbb}]" case (1)
wneuper@5088
   374
    Appl(List(
wneuper@5190
   375
      Constant("BOX.1"),
wneuper@5088
   376
      Appl(List(
wneuper@5088
   377
        Constant("CURSOR"),
wneuper@5088
   378
        Appl(List(
wneuper@5088
   379
          Constant("Groups.plus_class.plus"),
wneuper@5088
   380
          Variable("aaa"),
wneuper@5088
   381
          Variable("bbb")))))))
wneuper@5088
   382
   def nest_CURSOR_BOX_3B = //"{[aaa + bbb]}" case (2)
wneuper@5088
   383
    Appl(List(
wneuper@5088
   384
      Constant("CURSOR"),
wneuper@5088
   385
      Appl(List(
s1520454056@5183
   386
        Constant("BOX.8"),
wneuper@5088
   387
          Appl(List(
wneuper@5088
   388
            Constant("Groups.plus_class.plus"),
wneuper@5088
   389
            Variable("aaa"),
wneuper@5088
   390
            Variable("bbb")))))))
wneuper@5088
   391
   
wneuper@5143
   392
   /* 
wneuper@5143
   393
    * Input of "a + b/c + d" from scratch, UC \label{UC:gaps} Pt.2.
wneuper@5143
   394
    * The formula's structure requires 10 key hits for input of above 7 characters.
wneuper@5143
   395
    * Note the challenge of associativity in step UC_input_8b.
wneuper@5143
   396
    */
wneuper@5143
   397
   def UC_input_0 =
wneuper@5143
   398
    Appl(List(
wneuper@5143
   399
      Constant("CURSOR"),
wneuper@5143
   400
      Constant("GAP")))
wneuper@5143
   401
   def UC_input_1 =       // input "a"
wneuper@5143
   402
    Appl(List(
wneuper@5143
   403
      Variable("a"),
wneuper@5143
   404
      Constant("CURSOR")
wneuper@5143
   405
      ))
wneuper@5143
   406
   def UC_input_2 =       // input "+"
wneuper@5143
   407
    Appl(List(
wneuper@5143
   408
      Constant("Groups.plus_class.plus"),
wneuper@5143
   409
      Variable("a"),
wneuper@5143
   410
      Appl(List(
wneuper@5143
   411
        Constant("CURSOR"),
wneuper@5143
   412
        Constant("GAP")))
wneuper@5143
   413
      ))
wneuper@5143
   414
   def UC_input_3 =       // input "/" (instead of clicking menu item)
wneuper@5143
   415
    Appl(List(
wneuper@5143
   416
      Constant("Groups.plus_class.plus"),
wneuper@5143
   417
      Variable("a"),
wneuper@5143
   418
      Appl(List(
wneuper@5143
   419
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   420
        Appl(List(
wneuper@5143
   421
          Constant("CURSOR"),
wneuper@5143
   422
          Constant("GAP"))),
wneuper@5143
   423
        Constant("GAP")
wneuper@5143
   424
      ))))
wneuper@5143
   425
   def UC_input_4 =       // input "b"
wneuper@5143
   426
    Appl(List(
wneuper@5143
   427
      Constant("Groups.plus_class.plus"),
wneuper@5143
   428
      Variable("a"),
wneuper@5143
   429
      Appl(List(
wneuper@5143
   430
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   431
        Appl(List(
wneuper@5143
   432
          Variable("b"),
wneuper@5143
   433
          Constant("CURSOR"))),
wneuper@5143
   434
        Constant("GAP")
wneuper@5143
   435
      ))))
wneuper@5143
   436
   def UC_input_5 =       // input <next subterm on same level>
wneuper@5143
   437
    Appl(List(
wneuper@5143
   438
      Constant("Groups.plus_class.plus"),
wneuper@5143
   439
      Variable("a"),
wneuper@5143
   440
      Appl(List(
wneuper@5143
   441
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   442
        Variable("b"),
wneuper@5143
   443
        Appl(List(
wneuper@5143
   444
          Constant("CURSOR"),
wneuper@5143
   445
          Constant("GAP")))
wneuper@5143
   446
      ))))
wneuper@5143
   447
   def UC_input_6 =       // input "c"
wneuper@5143
   448
    Appl(List(
wneuper@5143
   449
      Constant("Groups.plus_class.plus"),
wneuper@5143
   450
      Variable("a"),
wneuper@5143
   451
      Appl(List(
wneuper@5143
   452
        Constant("Fields.inverse_class.divide"),
wneuper@5143
   453
        Variable("b"),
wneuper@5143
   454
        Appl(List(
wneuper@5143
   455
          Variable("c"),
wneuper@5143
   456
          Constant("CURSOR")))
wneuper@5143
   457
      ))))
wneuper@5143
   458
   def UC_input_7 =       // input <one level up>
wneuper@5143
   459
    Appl(List(
wneuper@5143
   460
      Constant("Groups.plus_class.plus"),
wneuper@5143
   461
      Variable("a"),
wneuper@5143
   462
      Appl(List(
wneuper@5143
   463
        Appl(List(
wneuper@5143
   464
          Constant("Fields.inverse_class.divide"),
wneuper@5143
   465
          Variable("b"),
wneuper@5143
   466
          Variable("c"))),
wneuper@5143
   467
        Constant("CURSOR")
wneuper@5143
   468
      ))))
wneuper@5143
   469
// this would create parentheses "a + (b/c + d)":
wneuper@5143
   470
//   def UC_input_8a =       // input "+"
wneuper@5143
   471
//    Appl(List(
wneuper@5143
   472
//      Constant("Groups.plus_class.plus"),
wneuper@5143
   473
//      Variable("a"),
wneuper@5143
   474
//      Appl(List(
wneuper@5143
   475
//        Constant("Groups.plus_class.plus"), // this would create parentheses !
wneuper@5143
   476
//        Appl(List(
wneuper@5143
   477
//          Appl(List(
wneuper@5143
   478
//            Constant("Fields.inverse_class.divide"),
wneuper@5143
   479
//            Variable("b"),
wneuper@5143
   480
//            Variable("c"))))),
wneuper@5143
   481
//          Appl(List(
wneuper@5143
   482
//            Constant("CURSOR"),
wneuper@5143
   483
//            Constant("GAP")))
wneuper@5143
   484
//      ))))
wneuper@5143
   485
   def UC_input_8b =      // input "+"
wneuper@5143
   486
    Appl(List(
wneuper@5143
   487
      Constant("Groups.plus_class.plus"),
wneuper@5143
   488
      Appl(List(
wneuper@5143
   489
        Constant("Groups.plus_class.plus"),
wneuper@5143
   490
        Variable("a"),
wneuper@5143
   491
          Appl(List(
wneuper@5143
   492
            Constant("Fields.inverse_class.divide"),
wneuper@5143
   493
            Variable("b"),
wneuper@5143
   494
            Variable("c"))),
wneuper@5143
   495
        Appl(List(
wneuper@5143
   496
          Constant("CURSOR"),
wneuper@5143
   497
          Constant("GAP")))
wneuper@5143
   498
      ))))
wneuper@5143
   499
   def UC_input_9 =       // input "d"
wneuper@5143
   500
    Appl(List(
wneuper@5143
   501
      Constant("Groups.plus_class.plus"),
wneuper@5143
   502
      Appl(List(
wneuper@5143
   503
        Constant("Groups.plus_class.plus"),
wneuper@5143
   504
        Variable("a"),
wneuper@5143
   505
          Appl(List(
wneuper@5143
   506
            Constant("Fields.inverse_class.divide"),
wneuper@5143
   507
            Variable("b"),
wneuper@5143
   508
            Variable("c"))),
wneuper@5143
   509
        Appl(List(
wneuper@5143
   510
          Variable("d"),
wneuper@5143
   511
          Constant("CURSOR")))
wneuper@5143
   512
      ))))
wneuper@5143
   513
   def UC_input_10 =      // input some key exiting editor
wneuper@5143
   514
    Appl(List(
wneuper@5143
   515
      Constant("Groups.plus_class.plus"),
wneuper@5143
   516
      Appl(List(
wneuper@5143
   517
        Constant("Groups.plus_class.plus"),
wneuper@5143
   518
        Variable("a"),
wneuper@5143
   519
          Appl(List(
wneuper@5143
   520
            Constant("Fields.inverse_class.divide"),
wneuper@5143
   521
            Variable("b"),
wneuper@5146
   522
            Variable("c"))))),
wneuper@5146
   523
      Variable("d")
wneuper@5146
   524
      ))
wneuper@5143
   525
  
wneuper@5088
   526
}