0

鸡计划 4.8.0.5

大家好,

这是列表列表的格式错误定义的片段。我说格式错误是因为变量名位于最左边的括号之外,并且没有明确的定义语句,即。(定义 techDisplays((AG1 填充忽略....零零))

片段.il

techDisplays(
;( LayerName            Purpose                  Packet                         Vis Sel C2C Drg Val )
;( ---------            -------                  ------                         --- --- --- --- --- )
( AG1                  fillerIgnore             AG1_fillerIgnore                t   t  nil  t  nil )
( AG2                  drawing                  AG2_drawing                     t   t  nil  t   t  )
( AG2                  fillerIgnore             AG2_fillerIgnore                t   t  nil  t  nil )
( AG2                  frame                    AG2_frame                       t   t  nil  t   t  )
( AG2                  frameOnly                AG2_frameOnly                   t   t  nil  t   t  )
( AG2                  frameOnlyHole            AG2_frameOnlyHole               t   t  nil  t   t  )
( y0               flight     y0_flight                 t   t   t   t   nil )
( y1               flight     y1_flight                 t   t   t   t   nil )
( y2               flight     y2_flight                 t   t   t   t   nil )
( y3               flight     y3_flight                 t   t   t   t   nil )
( y4               flight     y4_flight                 t   t   t   t   nil )
( y5               flight     y5_flight                 t   t   t   t   nil )
( y6               flight     y6_flight                 t   t   t   t   nil )
( y7               flight     y7_flight                 t   t   t   t   nil )
( y8               flight     y8_flight                 t   t   t   t   nil )
( y9               flight     y9_flight                 t   t   t   t   nil )
( border           boundary   border_boundary           t   nil t   t   nil )
( snap             grid       snap_grid                 t   nil t   nil nil )
) ;techDisplays

问题:我需要让 Scheme 将其识别为有效的顶级定义 进一步的问题:解决方案必须是可扩展的,因为这个解决方案的来源还有 100 多个我必须阅读约束:我非常非常不想必须编写一些解析例程,因为所有括号计数、匹配和分层很可能会出错。

欢迎任何想法、提示、建设性批评。

TIA,

仍在学习的史蒂夫

4

1 回答 1

0

考虑到这一点,

; this is structured as your input with just a space after the first name
#;1> (define inp 
             '(techdisps (foo bar baz) 
                         (foo1 bar1 baz1) 
                         (foo2 bar2 baz2))) 
#;2> inp
(techdisps (foo bar baz) (foo1 bar1 baz1) (foo2 bar2 baz2))
#;3> (define techdisps cdr)
;get all the displays from you input
#;4> (techdisps inp)
((foo bar baz) (foo1 bar1 baz1) (foo2 bar2 baz2))
;this should be just a tech display, let's see how it parses.
#;5> (car (techdisps inp))
(foo bar baz)
#;6> (define foo car)
#;7> (define bar cadr)
#;8> (define baz caddr)
;this will give us all the bazes
#;9> (map baz (techdisps inp))
(baz baz1 baz2)

如果您认为这不会扩展(尽管 100 多个不会是现代方案解释器在一个像样的盒子中难以处理的东西),我们可以建议替代方案。希望这可以帮助。

干杯。

于 2014-12-16T18:56:08.537 回答