-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * Copyright 2008 Jean Privat <jean@pryen.org>
- * Based on algorithms developped for ( http://www.sablecc.org/ ).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+$ // This file is part of NIT ( http://www.nitlanguage.org ).
+$ //
+$ // Copyright 2008 Jean Privat <jean@pryen.org>
+$ // Based on algorithms developped for ( http://www.sablecc.org/ ).
+$ //
+$ // Licensed under the Apache License, Version 2.0 (the "License");
+$ // you may not use this file except in compliance with the License.
+$ // You may obtain a copy of the License at
+$ //
+$ // http://www.apache.org/licenses/LICENSE-2.0
+$ //
+$ // Unless required by applicable law or agreed to in writing, software
+$ // distributed under the License is distributed on an "AS IS" BASIS,
+$ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+$ // See the License for the specific language governing permissions and
+$ // limitations under the License.
$ template make_lexer()
var _state: Int = 0
# Name of the stream (as given to tokens)
- readable var _filename: String
+ readable var _filename: String
# Input stream where character are read
var _stream: IStream
$ if {count(goto)!=0}
[
$ foreach {goto}
- [@low, @high, @state] [-sep ','-]
+ [@low, @high, @state][-sep ','-]
$ end foreach
- ] [-sep ','-]
+ ][-sep ','-]
$ else
- nil_array [-sep ','-]
+ nil_array[-sep ','-]
$ end
$ end foreach
- ] [-sep ','-]
+ ][-sep ','-]
$ end foreach
]
end
-
+
private fun nil_array: Array[Array[Int]]
do
return once new Array[Array[Int]]
private fun build_accept_table do
_accept_table = once [
$ foreach {lexer_data/accept_table/state}
- [
- [-foreach {i}-]${.} [-sep ','-] [-end foreach-]
+ [
+ [-foreach {i}-]${.}[-sep ','-][-end foreach-]
- ] [-sep ','-]
+ ][-sep ','-]
$ end foreach
]
end