rufus-lua-win 5.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/lib/rufus/lua/win.rb +18 -0
- data/lib/rufus/lua/win/version.rb +7 -0
- data/rufus-lua-win.gemspec +23 -0
- data/vendor/lua/bin/liblua.dll +0 -0
- data/vendor/lua/lib/lua/LuaXml.lua +119 -0
- data/vendor/lua/lib/lua/alien.lua +250 -0
- data/vendor/lua/lib/lua/alien/core.dll +0 -0
- data/vendor/lua/lib/lua/alien/struct.dll +0 -0
- data/vendor/lua/lib/lua/base.lua +536 -0
- data/vendor/lua/lib/lua/bin.lua +20 -0
- data/vendor/lua/lib/lua/bit.dll +0 -0
- data/vendor/lua/lib/lua/cdlua.dll +0 -0
- data/vendor/lua/lib/lua/cdluacontextplus.dll +0 -0
- data/vendor/lua/lib/lua/cdluagl.dll +0 -0
- data/vendor/lua/lib/lua/cdluaim.dll +0 -0
- data/vendor/lua/lib/lua/cdluapdf.dll +0 -0
- data/vendor/lua/lib/lua/copas.lua +543 -0
- data/vendor/lua/lib/lua/coxpcall.lua +57 -0
- data/vendor/lua/lib/lua/date.lua +745 -0
- data/vendor/lua/lib/lua/debug_ext.lua +84 -0
- data/vendor/lua/lib/lua/debug_init.lua +2 -0
- data/vendor/lua/lib/lua/des56.dll +0 -0
- data/vendor/lua/lib/lua/dist/config.lua +109 -0
- data/vendor/lua/lib/lua/dist/constraints.lua +271 -0
- data/vendor/lua/lib/lua/dist/depends.lua +601 -0
- data/vendor/lua/lib/lua/dist/git.lua +307 -0
- data/vendor/lua/lib/lua/dist/init.lua +278 -0
- data/vendor/lua/lib/lua/dist/manifest.lua +225 -0
- data/vendor/lua/lib/lua/dist/package.lua +583 -0
- data/vendor/lua/lib/lua/dist/sys.lua +367 -0
- data/vendor/lua/lib/lua/dist/utils.lua +130 -0
- data/vendor/lua/lib/lua/ex.dll +0 -0
- data/vendor/lua/lib/lua/fstable.lua +116 -0
- data/vendor/lua/lib/lua/getopt.lua +273 -0
- data/vendor/lua/lib/lua/git.lua +5 -0
- data/vendor/lua/lib/lua/git/core.dll +0 -0
- data/vendor/lua/lib/lua/git/objects.lua +121 -0
- data/vendor/lua/lib/lua/git/pack.lua +316 -0
- data/vendor/lua/lib/lua/git/protocol.lua +188 -0
- data/vendor/lua/lib/lua/git/repo.lua +283 -0
- data/vendor/lua/lib/lua/git/util.lua +233 -0
- data/vendor/lua/lib/lua/gzio.dll +0 -0
- data/vendor/lua/lib/lua/gzip.lua +81 -0
- data/vendor/lua/lib/lua/iconv.dll +0 -0
- data/vendor/lua/lib/lua/imlua.dll +0 -0
- data/vendor/lua/lib/lua/imlua_fftw.dll +0 -0
- data/vendor/lua/lib/lua/imlua_jp2.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process_omp.dll +0 -0
- data/vendor/lua/lib/lua/io_ext.lua +115 -0
- data/vendor/lua/lib/lua/iuplua.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_mglplot.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_pplot.dll +0 -0
- data/vendor/lua/lib/lua/iupluacd.dll +0 -0
- data/vendor/lua/lib/lua/iupluacontrols.dll +0 -0
- data/vendor/lua/lib/lua/iupluagl.dll +0 -0
- data/vendor/lua/lib/lua/iupluaim.dll +0 -0
- data/vendor/lua/lib/lua/iupluaimglib.dll +0 -0
- data/vendor/lua/lib/lua/iupluatuio.dll +0 -0
- data/vendor/lua/lib/lua/lanes-keeper.lua +302 -0
- data/vendor/lua/lib/lua/lanes.lua +591 -0
- data/vendor/lua/lib/lua/lanes/core.dll +0 -0
- data/vendor/lua/lib/lua/lcs.lua +55 -0
- data/vendor/lua/lib/lua/lemock.lua +659 -0
- data/vendor/lua/lib/lua/lfs.dll +0 -0
- data/vendor/lua/lib/lua/list.lua +375 -0
- data/vendor/lua/lib/lua/logging.lua +189 -0
- data/vendor/lua/lib/lua/logging/console.lua +22 -0
- data/vendor/lua/lib/lua/logging/email.lua +44 -0
- data/vendor/lua/lib/lua/logging/file.lua +55 -0
- data/vendor/lua/lib/lua/logging/rolling_file.lua +81 -0
- data/vendor/lua/lib/lua/logging/socket.lua +35 -0
- data/vendor/lua/lib/lua/logging/sql.lua +64 -0
- data/vendor/lua/lib/lua/loop/base.lua +68 -0
- data/vendor/lua/lib/lua/loop/cached.lua +312 -0
- data/vendor/lua/lib/lua/loop/collection/MapWithArrayOfKeys.lua +64 -0
- data/vendor/lua/lib/lua/loop/collection/ObjectCache.lua +39 -0
- data/vendor/lua/lib/lua/loop/collection/OrderedSet.lua +164 -0
- data/vendor/lua/lib/lua/loop/collection/PriorityQueue.lua +86 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArray.lua +32 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArraySet.lua +56 -0
- data/vendor/lua/lib/lua/loop/compiler/Arguments.lua +108 -0
- data/vendor/lua/lib/lua/loop/compiler/Conditional.lua +50 -0
- data/vendor/lua/lib/lua/loop/compiler/Expression.lua +215 -0
- data/vendor/lua/lib/lua/loop/component/base.lua +221 -0
- data/vendor/lua/lib/lua/loop/component/contained.lua +71 -0
- data/vendor/lua/lib/lua/loop/component/dynamic.lua +223 -0
- data/vendor/lua/lib/lua/loop/component/intercepted.lua +354 -0
- data/vendor/lua/lib/lua/loop/component/wrapped.lua +195 -0
- data/vendor/lua/lib/lua/loop/debug/Inspector.lua +521 -0
- data/vendor/lua/lib/lua/loop/debug/Matcher.lua +192 -0
- data/vendor/lua/lib/lua/loop/debug/Verbose.lua +266 -0
- data/vendor/lua/lib/lua/loop/debug/Viewer.lua +200 -0
- data/vendor/lua/lib/lua/loop/multiple.lua +105 -0
- data/vendor/lua/lib/lua/loop/object/Exception.lua +57 -0
- data/vendor/lua/lib/lua/loop/object/Publisher.lua +43 -0
- data/vendor/lua/lib/lua/loop/object/Wrapper.lua +39 -0
- data/vendor/lua/lib/lua/loop/scoped.lua +585 -0
- data/vendor/lua/lib/lua/loop/serial/FileStream.lua +48 -0
- data/vendor/lua/lib/lua/loop/serial/Serializer.lua +291 -0
- data/vendor/lua/lib/lua/loop/serial/SocketStream.lua +51 -0
- data/vendor/lua/lib/lua/loop/serial/StringStream.lua +47 -0
- data/vendor/lua/lib/lua/loop/simple.lua +75 -0
- data/vendor/lua/lib/lua/loop/table.lua +71 -0
- data/vendor/lua/lib/lua/loop/thread/CoSocket.lua +416 -0
- data/vendor/lua/lib/lua/loop/thread/IOScheduler.lua +170 -0
- data/vendor/lua/lib/lua/loop/thread/Scheduler.lua +327 -0
- data/vendor/lua/lib/lua/loop/thread/SocketScheduler.lua +88 -0
- data/vendor/lua/lib/lua/loop/thread/Timer.lua +54 -0
- data/vendor/lua/lib/lua/lpeg.dll +0 -0
- data/vendor/lua/lib/lua/ltn12.lua +292 -0
- data/vendor/lua/lib/lua/luaXML_lib.dll +0 -0
- data/vendor/lua/lib/lua/luacurl.dll +0 -0
- data/vendor/lua/lib/lua/luadoc/config.lua +34 -0
- data/vendor/lua/lib/lua/luadoc/doclet/debug.lua +46 -0
- data/vendor/lua/lib/lua/luadoc/doclet/formatter.lua +84 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html.lua +289 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/file.lp +113 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/function.lp +64 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/index.lp +70 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/luadoc.css +286 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/menu.lp +55 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/module.lp +109 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/table.lp +15 -0
- data/vendor/lua/lib/lua/luadoc/doclet/raw.lua +12 -0
- data/vendor/lua/lib/lua/luadoc/init.lua +58 -0
- data/vendor/lua/lib/lua/luadoc/lp.lua +130 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard.lua +495 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard/tags.lua +171 -0
- data/vendor/lua/lib/lua/luadoc/util.lua +233 -0
- data/vendor/lua/lib/lua/luagl.dll +0 -0
- data/vendor/lua/lib/lua/luaglu.dll +0 -0
- data/vendor/lua/lib/lua/luaidl.lua +113 -0
- data/vendor/lua/lib/lua/luaidl/lex.lua +793 -0
- data/vendor/lua/lib/lua/luaidl/pre.lua +149 -0
- data/vendor/lua/lib/lua/luaidl/sin.lua +3631 -0
- data/vendor/lua/lib/lua/luarocks/add.lua +108 -0
- data/vendor/lua/lib/lua/luarocks/admin_remove.lua +87 -0
- data/vendor/lua/lib/lua/luarocks/build.lua +330 -0
- data/vendor/lua/lib/lua/luarocks/build/builtin.lua +253 -0
- data/vendor/lua/lib/lua/luarocks/build/cmake.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/build/command.lua +32 -0
- data/vendor/lua/lib/lua/luarocks/build/make.lua +92 -0
- data/vendor/lua/lib/lua/luarocks/cache.lua +85 -0
- data/vendor/lua/lib/lua/luarocks/cfg.lua +449 -0
- data/vendor/lua/lib/lua/luarocks/command_line.lua +163 -0
- data/vendor/lua/lib/lua/luarocks/deps.lua +654 -0
- data/vendor/lua/lib/lua/luarocks/dir.lua +69 -0
- data/vendor/lua/lib/lua/luarocks/download.lua +90 -0
- data/vendor/lua/lib/lua/luarocks/fetch.lua +321 -0
- data/vendor/lua/lib/lua/luarocks/fetch/cvs.lua +44 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git.lua +81 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git_file.lua +17 -0
- data/vendor/lua/lib/lua/luarocks/fetch/hg.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/fetch/sscm.lua +42 -0
- data/vendor/lua/lib/lua/luarocks/fetch/svn.lua +53 -0
- data/vendor/lua/lib/lua/luarocks/fs.lua +40 -0
- data/vendor/lua/lib/lua/luarocks/fs/lua.lua +676 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix.lua +88 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix/tools.lua +325 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32.lua +107 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32/tools.lua +334 -0
- data/vendor/lua/lib/lua/luarocks/help.lua +101 -0
- data/vendor/lua/lib/lua/luarocks/index.lua +172 -0
- data/vendor/lua/lib/lua/luarocks/install.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/list.lua +35 -0
- data/vendor/lua/lib/lua/luarocks/loader.lua +228 -0
- data/vendor/lua/lib/lua/luarocks/make.lua +71 -0
- data/vendor/lua/lib/lua/luarocks/make_manifest.lua +34 -0
- data/vendor/lua/lib/lua/luarocks/manif.lua +360 -0
- data/vendor/lua/lib/lua/luarocks/manif_core.lua +75 -0
- data/vendor/lua/lib/lua/luarocks/new_version.lua +141 -0
- data/vendor/lua/lib/lua/luarocks/pack.lua +205 -0
- data/vendor/lua/lib/lua/luarocks/path.lua +315 -0
- data/vendor/lua/lib/lua/luarocks/persist.lua +173 -0
- data/vendor/lua/lib/lua/luarocks/refresh_cache.lua +30 -0
- data/vendor/lua/lib/lua/luarocks/remove.lua +135 -0
- data/vendor/lua/lib/lua/luarocks/rep.lua +313 -0
- data/vendor/lua/lib/lua/luarocks/require.lua +6 -0
- data/vendor/lua/lib/lua/luarocks/search.lua +399 -0
- data/vendor/lua/lib/lua/luarocks/show.lua +138 -0
- data/vendor/lua/lib/lua/luarocks/site_config.lua +23 -0
- data/vendor/lua/lib/lua/luarocks/tools/patch.lua +712 -0
- data/vendor/lua/lib/lua/luarocks/tools/tar.lua +144 -0
- data/vendor/lua/lib/lua/luarocks/tools/zip.lua +245 -0
- data/vendor/lua/lib/lua/luarocks/type_check.lua +267 -0
- data/vendor/lua/lib/lua/luarocks/unpack.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/util.lua +420 -0
- data/vendor/lua/lib/lua/luarocks/validate.lua +164 -0
- data/vendor/lua/lib/lua/luars232.dll +0 -0
- data/vendor/lua/lib/lua/luasql/mysql.dll +0 -0
- data/vendor/lua/lib/lua/luasql/postgres.dll +0 -0
- data/vendor/lua/lib/lua/luasql/sqlite3.dll +0 -0
- data/vendor/lua/lib/lua/luaunit.lua +601 -0
- data/vendor/lua/lib/lua/lxp.dll +0 -0
- data/vendor/lua/lib/lua/lxp/lom.lua +60 -0
- data/vendor/lua/lib/lua/math_ext.lua +27 -0
- data/vendor/lua/lib/lua/mbox.lua +53 -0
- data/vendor/lua/lib/lua/md5.lua +19 -0
- data/vendor/lua/lib/lua/md5/core.dll +0 -0
- data/vendor/lua/lib/lua/metalua.lua +0 -0
- data/vendor/lua/lib/lua/metalua/ast_to_string.mlua +553 -0
- data/vendor/lua/lib/lua/metalua/base.lua +104 -0
- data/vendor/lua/lib/lua/metalua/bytecode.lua +0 -0
- data/vendor/lua/lib/lua/metalua/clopts.mlua +204 -0
- data/vendor/lua/lib/lua/metalua/compiler.lua +3 -0
- data/vendor/lua/lib/lua/metalua/dollar.mlua +24 -0
- data/vendor/lua/lib/lua/metalua/extension/H-runtime.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/extension/H.mlua +22 -0
- data/vendor/lua/lib/lua/metalua/extension/anaphoric.mlua +54 -0
- data/vendor/lua/lib/lua/metalua/extension/clist.mlua +149 -0
- data/vendor/lua/lib/lua/metalua/extension/continue.mlua +53 -0
- data/vendor/lua/lib/lua/metalua/extension/localin.mlua +2 -0
- data/vendor/lua/lib/lua/metalua/extension/log.mlua +39 -0
- data/vendor/lua/lib/lua/metalua/extension/match.mlua +374 -0
- data/vendor/lua/lib/lua/metalua/extension/ternary.mlua +10 -0
- data/vendor/lua/lib/lua/metalua/extension/trycatch.mlua +189 -0
- data/vendor/lua/lib/lua/metalua/extension/types-runtime.mlua +159 -0
- data/vendor/lua/lib/lua/metalua/extension/types.mlua +352 -0
- data/vendor/lua/lib/lua/metalua/extension/withdo.mlua +30 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal-runtime.lua +41 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal.mlua +20 -0
- data/vendor/lua/lib/lua/metalua/extension/xloop.mlua +100 -0
- data/vendor/lua/lib/lua/metalua/extension/xmatch.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/metaloop.mlua +76 -0
- data/vendor/lua/lib/lua/metalua/mlc.lua +0 -0
- data/vendor/lua/lib/lua/metalua/mlc_xcall.lua +119 -0
- data/vendor/lua/lib/lua/metalua/mlp.lua +0 -0
- data/vendor/lua/lib/lua/metalua/package2.lua +101 -0
- data/vendor/lua/lib/lua/metalua/runtime.lua +3 -0
- data/vendor/lua/lib/lua/metalua/string2.lua +44 -0
- data/vendor/lua/lib/lua/metalua/table2.lua +372 -0
- data/vendor/lua/lib/lua/metalua/walk.mlua +304 -0
- data/vendor/lua/lib/lua/metalua/walk/bindings.mlua +41 -0
- data/vendor/lua/lib/lua/metalua/walk/id.mlua +186 -0
- data/vendor/lua/lib/lua/metalua/walk/scope.lua +54 -0
- data/vendor/lua/lib/lua/mime.lua +87 -0
- data/vendor/lua/lib/lua/mime/core.dll +0 -0
- data/vendor/lua/lib/lua/mobdebug.lua +1484 -0
- data/vendor/lua/lib/lua/modules.lua +16 -0
- data/vendor/lua/lib/lua/object.lua +56 -0
- data/vendor/lua/lib/lua/oil/Exception.lua +26 -0
- data/vendor/lua/lib/lua/oil/arch.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/basic/client.lua +29 -0
- data/vendor/lua/lib/lua/oil/arch/basic/common.lua +13 -0
- data/vendor/lua/lib/lua/oil/arch/basic/server.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/common.lua +10 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/server.lua +16 -0
- data/vendor/lua/lib/lua/oil/arch/corba/client.lua +39 -0
- data/vendor/lua/lib/lua/oil/arch/corba/common.lua +58 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/client.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/server.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/server.lua +35 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/byref.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/client.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/common.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/server.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/typed/client.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/typed/common.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/typed/server.lua +18 -0
- data/vendor/lua/lib/lua/oil/assert.lua +87 -0
- data/vendor/lua/lib/lua/oil/builder.lua +45 -0
- data/vendor/lua/lib/lua/oil/builder/basic/client.lua +31 -0
- data/vendor/lua/lib/lua/oil/builder/basic/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/basic/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/common.lua +24 -0
- data/vendor/lua/lib/lua/oil/builder/corba/gencode.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/lua/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/lua/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/byref.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/common.lua +14 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/typed/client.lua +16 -0
- data/vendor/lua/lib/lua/oil/builder/typed/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/compat.lua +846 -0
- data/vendor/lua/lib/lua/oil/component.lua +1 -0
- data/vendor/lua/lib/lua/oil/corba/giop.lua +301 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Codec.lua +1568 -0
- data/vendor/lua/lib/lua/oil/corba/giop/CodecGen.lua +589 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Exception.lua +25 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Indexer.lua +63 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Listener.lua +343 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Messenger.lua +228 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Referrer.lua +180 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Requester.lua +462 -0
- data/vendor/lua/lib/lua/oil/corba/idl.lua +597 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Compiler.lua +133 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Importer.lua +235 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Indexer.lua +95 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Registry.lua +1821 -0
- data/vendor/lua/lib/lua/oil/corba/idl/ir.lua +847 -0
- data/vendor/lua/lib/lua/oil/corba/idl/sysex.lua +21 -0
- data/vendor/lua/lib/lua/oil/corba/iiop/Profiler.lua +200 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Listener.lua +158 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Requester.lua +181 -0
- data/vendor/lua/lib/lua/oil/corba/services/event.lua +126 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ConsumerAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventFactory.lua +15 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventQueue.lua +37 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushConsumer.lua +75 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushSupplier.lua +62 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleDeferredDispatcher.lua +60 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleSynchronousDispatcher.lua +39 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SupplierAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/naming.lua +436 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Acceptor.lua +268 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Channels.lua +121 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Connector.lua +147 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Dispatcher.lua +99 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies.lua +86 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/asynchronous.lua +56 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/protected.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/synchronous.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/utils.lua +29 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Receiver.lua +110 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Servants.lua +207 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Sockets.lua +44 -0
- data/vendor/lua/lib/lua/oil/kernel/cooperative/Receiver.lua +139 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Listener.lua +47 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Requester.lua +58 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Dispatcher.lua +76 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Proxies.lua +69 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Dispatcher.lua +91 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Proxies.lua +153 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Servants.lua +137 -0
- data/vendor/lua/lib/lua/oil/ludo/Codec.lua +66 -0
- data/vendor/lua/lib/lua/oil/ludo/CodecByRef.lua +103 -0
- data/vendor/lua/lib/lua/oil/ludo/Listener.lua +151 -0
- data/vendor/lua/lib/lua/oil/ludo/Referrer.lua +72 -0
- data/vendor/lua/lib/lua/oil/ludo/Requester.lua +107 -0
- data/vendor/lua/lib/lua/oil/oo.lua +1 -0
- data/vendor/lua/lib/lua/oil/port.lua +1 -0
- data/vendor/lua/lib/lua/oil/properties.lua +57 -0
- data/vendor/lua/lib/lua/oil/verbose.lua +133 -0
- data/vendor/lua/lib/lua/package_ext.lua +15 -0
- data/vendor/lua/lib/lua/parser.lua +268 -0
- data/vendor/lua/lib/lua/pl/Date.lua +555 -0
- data/vendor/lua/lib/lua/pl/List.lua +613 -0
- data/vendor/lua/lib/lua/pl/Map.lua +113 -0
- data/vendor/lua/lib/lua/pl/MultiMap.lua +62 -0
- data/vendor/lua/lib/lua/pl/OrderedMap.lua +151 -0
- data/vendor/lua/lib/lua/pl/Set.lua +153 -0
- data/vendor/lua/lib/lua/pl/app.lua +165 -0
- data/vendor/lua/lib/lua/pl/array2d.lua +501 -0
- data/vendor/lua/lib/lua/pl/class.lua +180 -0
- data/vendor/lua/lib/lua/pl/comprehension.lua +286 -0
- data/vendor/lua/lib/lua/pl/config.lua +176 -0
- data/vendor/lua/lib/lua/pl/data.lua +606 -0
- data/vendor/lua/lib/lua/pl/dir.lua +475 -0
- data/vendor/lua/lib/lua/pl/file.lua +70 -0
- data/vendor/lua/lib/lua/pl/func.lua +376 -0
- data/vendor/lua/lib/lua/pl/init.lua +68 -0
- data/vendor/lua/lib/lua/pl/input.lua +173 -0
- data/vendor/lua/lib/lua/pl/lapp.lua +407 -0
- data/vendor/lua/lib/lua/pl/lexer.lua +456 -0
- data/vendor/lua/lib/lua/pl/luabalanced.lua +264 -0
- data/vendor/lua/lib/lua/pl/operator.lua +201 -0
- data/vendor/lua/lib/lua/pl/path.lua +398 -0
- data/vendor/lua/lib/lua/pl/permute.lua +63 -0
- data/vendor/lua/lib/lua/pl/platf/luajava.lua +101 -0
- data/vendor/lua/lib/lua/pl/pretty.lua +285 -0
- data/vendor/lua/lib/lua/pl/seq.lua +551 -0
- data/vendor/lua/lib/lua/pl/sip.lua +344 -0
- data/vendor/lua/lib/lua/pl/strict.lua +70 -0
- data/vendor/lua/lib/lua/pl/stringio.lua +158 -0
- data/vendor/lua/lib/lua/pl/stringx.lua +440 -0
- data/vendor/lua/lib/lua/pl/tablex.lua +817 -0
- data/vendor/lua/lib/lua/pl/template.lua +103 -0
- data/vendor/lua/lib/lua/pl/test.lua +135 -0
- data/vendor/lua/lib/lua/pl/text.lua +243 -0
- data/vendor/lua/lib/lua/pl/utils.lua +550 -0
- data/vendor/lua/lib/lua/pl/xml.lua +689 -0
- data/vendor/lua/lib/lua/profiler.dll +0 -0
- data/vendor/lua/lib/lua/re.lua +248 -0
- data/vendor/lua/lib/lua/rex_onig.dll +0 -0
- data/vendor/lua/lib/lua/rex_pcre.dll +0 -0
- data/vendor/lua/lib/lua/rex_posix.dll +0 -0
- data/vendor/lua/lib/lua/rings.dll +0 -0
- data/vendor/lua/lib/lua/serialize.lua +193 -0
- data/vendor/lua/lib/lua/set.lua +149 -0
- data/vendor/lua/lib/lua/socket.lua +133 -0
- data/vendor/lua/lib/lua/socket/core.dll +0 -0
- data/vendor/lua/lib/lua/socket/ftp.lua +281 -0
- data/vendor/lua/lib/lua/socket/http.lua +350 -0
- data/vendor/lua/lib/lua/socket/smtp.lua +251 -0
- data/vendor/lua/lib/lua/socket/tp.lua +123 -0
- data/vendor/lua/lib/lua/socket/url.lua +297 -0
- data/vendor/lua/lib/lua/ssl.dll +0 -0
- data/vendor/lua/lib/lua/ssl.lua +93 -0
- data/vendor/lua/lib/lua/ssl/https.lua +138 -0
- data/vendor/lua/lib/lua/stable.lua +28 -0
- data/vendor/lua/lib/lua/std.lua +16 -0
- data/vendor/lua/lib/lua/strbuf.lua +32 -0
- data/vendor/lua/lib/lua/strict.lua +45 -0
- data/vendor/lua/lib/lua/string_ext.lua +274 -0
- data/vendor/lua/lib/lua/table_ext.lua +117 -0
- data/vendor/lua/lib/lua/tar.lua +262 -0
- data/vendor/lua/lib/lua/task.dll +0 -0
- data/vendor/lua/lib/lua/tree.lua +81 -0
- data/vendor/lua/lib/lua/unicode.dll +0 -0
- data/vendor/lua/lib/lua/verbose_require.lua +11 -0
- data/vendor/lua/lib/lua/vstruct.lua +86 -0
- data/vendor/lua/lib/lua/vstruct/ast.lua +192 -0
- data/vendor/lua/lib/lua/vstruct/ast/Bitpack.lua +33 -0
- data/vendor/lua/lib/lua/vstruct/ast/Generator.lua +174 -0
- data/vendor/lua/lib/lua/vstruct/ast/IO.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/ast/List.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/ast/Name.lua +20 -0
- data/vendor/lua/lib/lua/vstruct/ast/Repeat.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/ast/Root.lua +19 -0
- data/vendor/lua/lib/lua/vstruct/ast/Table.lua +65 -0
- data/vendor/lua/lib/lua/vstruct/cursor.lua +81 -0
- data/vendor/lua/lib/lua/vstruct/io.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/io/a.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/b.lua +28 -0
- data/vendor/lua/lib/lua/vstruct/io/bigendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/c.lua +25 -0
- data/vendor/lua/lib/lua/vstruct/io/defaults.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/endianness.lua +41 -0
- data/vendor/lua/lib/lua/vstruct/io/f.lua +129 -0
- data/vendor/lua/lib/lua/vstruct/io/hostendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/i.lua +42 -0
- data/vendor/lua/lib/lua/vstruct/io/littleendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/m.lua +62 -0
- data/vendor/lua/lib/lua/vstruct/io/p.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/io/s.lua +27 -0
- data/vendor/lua/lib/lua/vstruct/io/seekb.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekf.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekto.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/u.lua +54 -0
- data/vendor/lua/lib/lua/vstruct/io/x.lua +34 -0
- data/vendor/lua/lib/lua/vstruct/io/z.lua +63 -0
- data/vendor/lua/lib/lua/vstruct/lexer.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/pack.lua +142 -0
- data/vendor/lua/lib/lua/vstruct/test.lua +47 -0
- data/vendor/lua/lib/lua/vstruct/test/basic.lua +73 -0
- data/vendor/lua/lib/lua/vstruct/test/common.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-bigendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-littleendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/struct-test-gen.lua +1230 -0
- data/vendor/lua/lib/lua/vstruct/unpack.lua +126 -0
- data/vendor/lua/lib/lua/wx.dll +0 -0
- data/vendor/lua/lib/lua/xml.lua +75 -0
- data/vendor/lua/lib/lua/zip.dll +0 -0
- data/vendor/lua/lib/lua/zlib.dll +0 -0
- metadata +529 -0
@@ -0,0 +1,793 @@
|
|
1
|
+
--
|
2
|
+
-- Project: LuaIDL
|
3
|
+
-- Author: Ricardo Cosme <rcosme@tecgraf.puc-rio.br>
|
4
|
+
-- Filename: lex.lua
|
5
|
+
--
|
6
|
+
|
7
|
+
local type = type
|
8
|
+
local pairs = pairs
|
9
|
+
local tonumber = tonumber
|
10
|
+
local error = error
|
11
|
+
local ipairs = ipairs
|
12
|
+
local table = table
|
13
|
+
local string = require "string"
|
14
|
+
|
15
|
+
module 'luaidl.lex'
|
16
|
+
|
17
|
+
tab_tokens = {
|
18
|
+
TK_ID = 257, TK_ABSTRACT = 258, TK_ANY = 259, TK_ATTRIBUTE = 260,
|
19
|
+
TK_BOOLEAN = 261, TK_CASE = 262, TK_CHAR = 263, TK_COMPONENT = 264,
|
20
|
+
TK_CONST = 265, TK_CONSUMES = 266, TK_CONTEXT = 267, TK_CUSTOM = 268,
|
21
|
+
TK_DEFAULT = 269, TK_DOUBLE = 270, TK_EXCEPTION = 271, TK_EMITS = 272,
|
22
|
+
TK_ENUM = 273, TK_EVENTTYPE = 274, TK_FACTORY = 275, TK_FALSE = 276,
|
23
|
+
TK_FINDER = 277, TK_FIXED = 278, TK_FLOAT = 279, TK_GETRAISES = 280,
|
24
|
+
TK_HOME = 281, TK_IMPORT = 282, TK_IN = 283, TK_INOUT = 284,
|
25
|
+
TK_INTERFACE = 285, TK_LOCAL = 286, TK_LONG = 287, TK_MODULE = 288,
|
26
|
+
TK_MULTIPLE = 289, TK_NATIVE = 290, TK_OBJECT = 291, TK_OCTET = 292,
|
27
|
+
TK_ONEWAY = 293, TK_OUT = 294, TK_PRIMARYKEY = 295, TK_PRIVATE = 296,
|
28
|
+
TK_PROVIDES = 297, TK_PUBLIC = 298, TK_PUBLISHES = 299, TK_RAISES = 300,
|
29
|
+
TK_READONLY = 301, TK_SETRAISES = 302, TK_SEQUENCE = 303, TK_SHORT = 304,
|
30
|
+
TK_STRING = 305, TK_STRUCT = 306, TK_SUPPORTS = 307, TK_SWITCH = 308,
|
31
|
+
TK_TRUE = 309, TK_TRUNCATABLE = 310, TK_TYPEDEF = 311, TK_TYPEID = 312,
|
32
|
+
TK_TYPEPREFIX = 313, TK_UNSIGNED = 314, TK_UNION = 315, TK_USES = 316,
|
33
|
+
TK_VALUEBASE = 317, TK_VALUETYPE = 318, TK_VOID = 319, TK_WCHAR = 320,
|
34
|
+
TK_WSTRING = 321, TK_INTEGER_LITERAL = 322, TK_FLOAT_LITERAL = 323,
|
35
|
+
TK_CHAR_LITERAL = 324, TK_WCHAR_LITERAL = 325, TK_STRING_LITERAL = 326,
|
36
|
+
TK_WSTRING_LITERAL = 327, TK_FIXED_LITERAL = 328, TK_PRAGMA_PREFIX = 329,
|
37
|
+
TK_PRAGMA_ID = 330, TK_MANAGES = 332,
|
38
|
+
}
|
39
|
+
|
40
|
+
local tab_keywords = {
|
41
|
+
['abstract'] = { token = tab_tokens.TK_ABSTRACT },
|
42
|
+
['any'] = { token = tab_tokens.TK_ANY },
|
43
|
+
['attribute'] = { token = tab_tokens.TK_ATTRIBUTE },
|
44
|
+
['boolean'] = { token = tab_tokens.TK_BOOLEAN },
|
45
|
+
['case'] = { token = tab_tokens.TK_CASE },
|
46
|
+
['char'] = { token = tab_tokens.TK_CHAR },
|
47
|
+
['component'] = { token = tab_tokens.TK_COMPONENT },
|
48
|
+
['const'] = { token = tab_tokens.TK_CONST },
|
49
|
+
['consumes'] = { token = tab_tokens.TK_CONSUMES },
|
50
|
+
['context'] = { token = tab_tokens.TK_CONTEXT },
|
51
|
+
['custom'] = { token = tab_tokens.TK_CUSTOM },
|
52
|
+
['default'] = { token = tab_tokens.TK_DEFAULT },
|
53
|
+
['double'] = { token = tab_tokens.TK_DOUBLE },
|
54
|
+
['exception'] = { token = tab_tokens.TK_EXCEPTION },
|
55
|
+
['emits'] = { token = tab_tokens.TK_EMITS },
|
56
|
+
['enum'] = { token = tab_tokens.TK_ENUM },
|
57
|
+
['eventtype'] = { token = tab_tokens.TK_EVENTTYPE },
|
58
|
+
['factory'] = { token = tab_tokens.TK_FACTORY },
|
59
|
+
['FALSE'] = { token = tab_tokens.TK_FALSE },
|
60
|
+
['finder'] = { token = tab_tokens.TK_FINDER },
|
61
|
+
['fixed'] = { token = tab_tokens.TK_FIXED },
|
62
|
+
['float'] = { token = tab_tokens.TK_FLOAT },
|
63
|
+
['getraises'] = { token = tab_tokens.TK_GETRAISES },
|
64
|
+
['home'] = { token = tab_tokens.TK_HOME },
|
65
|
+
['import'] = { token = tab_tokens.TK_IMPORT },
|
66
|
+
['in'] = { token = tab_tokens.TK_IN },
|
67
|
+
['inout'] = { token = tab_tokens.TK_INOUT },
|
68
|
+
['interface'] = { token = tab_tokens.TK_INTERFACE },
|
69
|
+
['local'] = { token = tab_tokens.TK_LOCAL },
|
70
|
+
['long'] = { token = tab_tokens.TK_LONG },
|
71
|
+
['manages'] = { token = tab_tokens.TK_MANAGES },
|
72
|
+
['module'] = { token = tab_tokens.TK_MODULE },
|
73
|
+
['multiple'] = { token = tab_tokens.TK_MULTIPLE },
|
74
|
+
['native'] = { token = tab_tokens.TK_NATIVE },
|
75
|
+
['Object'] = { token = tab_tokens.TK_OBJECT },
|
76
|
+
['octet'] = { token = tab_tokens.TK_OCTET },
|
77
|
+
['oneway'] = { token = tab_tokens.TK_ONEWAY },
|
78
|
+
['out'] = { token = tab_tokens.TK_OUT },
|
79
|
+
['primarykey'] = { token = tab_tokens.TK_PRIMARYKEY },
|
80
|
+
['private'] = { token = tab_tokens.TK_PRIVATE },
|
81
|
+
['provides'] = { token = tab_tokens.TK_PROVIDES },
|
82
|
+
['public'] = { token = tab_tokens.TK_PUBLIC },
|
83
|
+
['publishes'] = { token = tab_tokens.TK_PUBLISHES },
|
84
|
+
['raises'] = { token = tab_tokens.TK_RAISES },
|
85
|
+
['readonly'] = { token = tab_tokens.TK_READONLY },
|
86
|
+
['setraises'] = { token = tab_tokens.TK_SETRAISES },
|
87
|
+
['sequence'] = { token = tab_tokens.TK_SEQUENCE },
|
88
|
+
['short'] = { token = tab_tokens.TK_SHORT },
|
89
|
+
['string'] = { token = tab_tokens.TK_STRING },
|
90
|
+
['struct'] = { token = tab_tokens.TK_STRUCT },
|
91
|
+
['supports'] = { token = tab_tokens.TK_SUPPORTS },
|
92
|
+
['switch'] = { token = tab_tokens.TK_SWITCH },
|
93
|
+
['TRUE'] = { token = tab_tokens.TK_TRUE },
|
94
|
+
['truncatable'] = { token = tab_tokens.TK_TRUNCATABLE },
|
95
|
+
['typedef'] = { token = tab_tokens.TK_TYPEDEF },
|
96
|
+
['typeid'] = { token = tab_tokens.TK_TYPEID },
|
97
|
+
['typeprefix'] = { token = tab_tokens.TK_TYPEPREFIX },
|
98
|
+
['unsigned'] = { token = tab_tokens.TK_UNSIGNED },
|
99
|
+
['union'] = { token = tab_tokens.TK_UNION },
|
100
|
+
['uses'] = { token = tab_tokens.TK_USES },
|
101
|
+
['ValueBase'] = { token = tab_tokens.TK_VALUEBASE },
|
102
|
+
['valuetype'] = { token = tab_tokens.TK_VALUETYPE },
|
103
|
+
['void'] = { token = tab_tokens.TK_VOID },
|
104
|
+
['wchar'] = { token = tab_tokens.TK_WCHAR },
|
105
|
+
['wstring'] = { token = tab_tokens.TK_WSTRING },
|
106
|
+
}
|
107
|
+
|
108
|
+
local tab_symbols
|
109
|
+
|
110
|
+
PRAGMA_VERSION = '1.0'
|
111
|
+
local ERROR_MSG_TYPE = '[lexical error]:_LINE:_ERRORMSG.'
|
112
|
+
|
113
|
+
local token
|
114
|
+
local lookahead
|
115
|
+
local i
|
116
|
+
local stridllen
|
117
|
+
local linemarkDeclared
|
118
|
+
|
119
|
+
local function is_blank(char)
|
120
|
+
if (lookahead == ' ' or lookahead == '\f' or lookahead == '\r' or
|
121
|
+
lookahead == '\t' or lookahead == '\v') then
|
122
|
+
return true
|
123
|
+
else
|
124
|
+
return false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
local function is_digit(char)
|
129
|
+
return string.find(char, '%d')
|
130
|
+
end
|
131
|
+
|
132
|
+
local function is_hex_digit(char)
|
133
|
+
return string.find(char, '%x')
|
134
|
+
end
|
135
|
+
|
136
|
+
local function is_octal_digit(char)
|
137
|
+
return string.find(char, '[0-7]')
|
138
|
+
end
|
139
|
+
|
140
|
+
local function is_alpha(char)
|
141
|
+
return string.find(char, '%w')
|
142
|
+
end
|
143
|
+
|
144
|
+
local function is_near_value(lookahead)
|
145
|
+
if string.find(lookahead, '%w') then
|
146
|
+
return ' near \''..lookahead..'\''
|
147
|
+
else
|
148
|
+
return ''
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
local function insert_symbols(lexeme)
|
153
|
+
tab_symbols[lexeme] = {token = tab_tokens.TK_ID, descriptions = {}}
|
154
|
+
end
|
155
|
+
|
156
|
+
local function validate_symbol(lexeme, tab_symbols)
|
157
|
+
if tab_symbols[lexeme] then
|
158
|
+
return lexeme, tab_symbols[lexeme].token
|
159
|
+
else
|
160
|
+
for key, value in pairs(tab_symbols) do
|
161
|
+
if string.upper(lexeme) == string.upper(key) then
|
162
|
+
return key, 'collide'
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
return nil, nil
|
167
|
+
end
|
168
|
+
|
169
|
+
local function search_symbol(lexeme, tab_symbols)
|
170
|
+
if tab_symbols[lexeme] then
|
171
|
+
return lexeme, tab_symbols[lexeme].token
|
172
|
+
end
|
173
|
+
return nil, nil
|
174
|
+
end
|
175
|
+
|
176
|
+
local function error_lex(error_msg)
|
177
|
+
if (type(ERROR_MSG_TYPE) ~= 'string') then
|
178
|
+
error('bad value to \'error_msg_type\' variable (string expected)', 2)
|
179
|
+
end
|
180
|
+
init()
|
181
|
+
local _LINE = line
|
182
|
+
error(string.gsub(string.gsub(ERROR_MSG_TYPE, '_LINE', _LINE),
|
183
|
+
'_ERRORMSG', error_msg), 3)
|
184
|
+
end
|
185
|
+
|
186
|
+
local function get_constructor (symbol_name)
|
187
|
+
if tab_symbols[symbol_name] then
|
188
|
+
return tab_symbols[symbol_name].descriptions
|
189
|
+
else
|
190
|
+
return nil
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
local function set_constructor (symbol_name, field_name, value)
|
195
|
+
for k, v in ipairs(tab_symbols) do
|
196
|
+
if (v.lexeme == symbol_name) then
|
197
|
+
v.descriptions[field_name] = value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
return nil
|
201
|
+
end
|
202
|
+
|
203
|
+
local function lineCount()
|
204
|
+
line = line + 1
|
205
|
+
end
|
206
|
+
|
207
|
+
local function getchar(stridl)
|
208
|
+
if (i > stridllen) then
|
209
|
+
return nil
|
210
|
+
else
|
211
|
+
local c = string.sub(stridl, i, i)
|
212
|
+
i = i + 1
|
213
|
+
return c
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
function init()
|
218
|
+
tab_symbols = { }
|
219
|
+
token = nil
|
220
|
+
tokenvalue = '<EOF>'
|
221
|
+
tokenvalue_previous = '<EOF>'
|
222
|
+
line = 1
|
223
|
+
srcfilename = ''
|
224
|
+
tab_linemarks = { }
|
225
|
+
lookahead = ' '
|
226
|
+
i = 1
|
227
|
+
stridllen = nil
|
228
|
+
end
|
229
|
+
|
230
|
+
function lexer(stridl)
|
231
|
+
if not stridllen then
|
232
|
+
init()
|
233
|
+
stridllen = string.len(stridl)
|
234
|
+
end
|
235
|
+
|
236
|
+
while true do
|
237
|
+
tokenvalue_previous = tokenvalue
|
238
|
+
|
239
|
+
if not lookahead then
|
240
|
+
init()
|
241
|
+
return token
|
242
|
+
elseif (lookahead == '#') then
|
243
|
+
lookahead = getchar(stridl)
|
244
|
+
-- C preprocessor
|
245
|
+
-- # <linenum> "<filename>" <flags>*
|
246
|
+
if (lookahead == ' ') then
|
247
|
+
linemarkDeclared = true
|
248
|
+
-- linenum
|
249
|
+
local linenum = getchar(stridl)
|
250
|
+
lookahead = getchar(stridl)
|
251
|
+
while is_digit(lookahead) do
|
252
|
+
linenum = linenum..lookahead
|
253
|
+
lookahead = getchar(stridl)
|
254
|
+
end
|
255
|
+
line = tonumber(linenum)
|
256
|
+
-- filename
|
257
|
+
-- '"' char
|
258
|
+
local _ = getchar(stridl)
|
259
|
+
local filename = ''
|
260
|
+
lookahead = getchar(stridl)
|
261
|
+
while (lookahead ~= '"') do
|
262
|
+
filename = filename..lookahead
|
263
|
+
lookahead = getchar(stridl)
|
264
|
+
end
|
265
|
+
srcfilename = filename
|
266
|
+
lookahead = getchar(stridl)
|
267
|
+
-- flags
|
268
|
+
local flags = { }
|
269
|
+
while (lookahead == ' ') do
|
270
|
+
lookahead = getchar(stridl)
|
271
|
+
if is_digit(lookahead) then
|
272
|
+
flags[lookahead] = true
|
273
|
+
end
|
274
|
+
lookahead = getchar(stridl)
|
275
|
+
end
|
276
|
+
table.insert(tab_linemarks, flags)
|
277
|
+
-- pragma declarations
|
278
|
+
elseif (lookahead == 'p') then
|
279
|
+
lookahead = getchar(stridl)
|
280
|
+
if (lookahead == 'r') then
|
281
|
+
lookahead = getchar(stridl)
|
282
|
+
if (lookahead == 'a') then
|
283
|
+
lookahead = getchar(stridl)
|
284
|
+
if (lookahead == 'g') then
|
285
|
+
lookahead = getchar(stridl)
|
286
|
+
if (lookahead == 'm') then
|
287
|
+
lookahead = getchar(stridl)
|
288
|
+
if (lookahead == 'a') then
|
289
|
+
lookahead = getchar(stridl)
|
290
|
+
if is_blank(lookahead) then
|
291
|
+
lookahead = getchar(stridl)
|
292
|
+
end
|
293
|
+
-- pragma prefix
|
294
|
+
if (lookahead == 'p') then
|
295
|
+
lookahead = getchar(stridl)
|
296
|
+
if (lookahead == 'r') then
|
297
|
+
lookahead = getchar(stridl)
|
298
|
+
if (lookahead == 'e') then
|
299
|
+
lookahead = getchar(stridl)
|
300
|
+
if (lookahead == 'f') then
|
301
|
+
lookahead = getchar(stridl)
|
302
|
+
if (lookahead == 'i') then
|
303
|
+
lookahead = getchar(stridl)
|
304
|
+
if (lookahead == 'x') then
|
305
|
+
lookahead = getchar(stridl)
|
306
|
+
token = tab_tokens.TK_PRAGMA_PREFIX
|
307
|
+
return token
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
-- pragma ID
|
314
|
+
elseif (lookahead == 'I') then
|
315
|
+
lookahead = getchar(stridl)
|
316
|
+
if (lookahead == 'D') then
|
317
|
+
lookahead = getchar(stridl)
|
318
|
+
token = tab_tokens.TK_PRAGMA_ID
|
319
|
+
return token
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
-- new lines
|
329
|
+
elseif (lookahead == '\n') then
|
330
|
+
-- We does not consider linemark declarations to line counts.
|
331
|
+
if not linemarkDeclared then
|
332
|
+
lineCount()
|
333
|
+
else
|
334
|
+
linemarkDeclared = false
|
335
|
+
end
|
336
|
+
lookahead = getchar(stridl)
|
337
|
+
-- blank characters
|
338
|
+
elseif is_blank(lookahead) then
|
339
|
+
lookahead = getchar(stridl)
|
340
|
+
-- comments
|
341
|
+
elseif (lookahead == '/') then
|
342
|
+
lookahead = getchar(stridl)
|
343
|
+
if (lookahead == '/') then
|
344
|
+
while (lookahead ~= '\n') do
|
345
|
+
lookahead = getchar(stridl)
|
346
|
+
end
|
347
|
+
lineCount()
|
348
|
+
lookahead = getchar(stridl)
|
349
|
+
elseif (lookahead == '*') then
|
350
|
+
local first_line = line
|
351
|
+
lookahead = getchar(stridl)
|
352
|
+
while true do
|
353
|
+
if (lookahead == '\n') then
|
354
|
+
lookahead = getchar(stridl)
|
355
|
+
lineCount()
|
356
|
+
elseif not lookahead then
|
357
|
+
-- where begin nonterminated comment ?
|
358
|
+
line = first_line
|
359
|
+
error_lex('nonterminated comment')
|
360
|
+
elseif (lookahead == '*') then
|
361
|
+
lookahead = getchar(stridl)
|
362
|
+
if (lookahead == '/') then
|
363
|
+
break
|
364
|
+
end
|
365
|
+
else
|
366
|
+
lookahead = getchar(stridl)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
lookahead = getchar(stridl)
|
370
|
+
else
|
371
|
+
tokenvalue = '/'
|
372
|
+
token = tokenvalue
|
373
|
+
return token
|
374
|
+
end
|
375
|
+
-- floating-point literals
|
376
|
+
-- fixed-point literals
|
377
|
+
elseif (lookahead == '.') then
|
378
|
+
tokenvalue = '.'
|
379
|
+
lookahead = getchar(stridl)
|
380
|
+
if is_digit(lookahead) then
|
381
|
+
tokenvalue = tokenvalue..lookahead
|
382
|
+
lookahead = getchar(stridl)
|
383
|
+
while is_digit(lookahead) do
|
384
|
+
tokenvalue = tokenvalue..lookahead
|
385
|
+
lookahead = getchar()
|
386
|
+
end
|
387
|
+
if (lookahead == 'e' or lookahead == 'E') then
|
388
|
+
tokenvalue = tokenvalue..lookahead
|
389
|
+
lookahead = getchar(stridl)
|
390
|
+
if (lookahead == '-') then
|
391
|
+
tokenvalue = tokenvalue..lookahead
|
392
|
+
lookahead = getchar(stridl)
|
393
|
+
if not is_digit(lookahead) then
|
394
|
+
error_lex('malformed number'..is_near_value(tokenvalue))
|
395
|
+
else
|
396
|
+
tokenvalue = tokenvalue..lookahead
|
397
|
+
lookahead = getchar(stridl)
|
398
|
+
while is_digit(lookahead) do
|
399
|
+
tokenvalue = tokenvalue..lookahead
|
400
|
+
lookahead = getchar(stridl)
|
401
|
+
end
|
402
|
+
end
|
403
|
+
elseif is_digit(lookahead) then
|
404
|
+
tokenvalue = tokenvalue..lookahead
|
405
|
+
lookahead = getchar(stridl)
|
406
|
+
while is_digit(lookahead) do
|
407
|
+
tokenvalue = tokenvalue..lookahead
|
408
|
+
lookahead = getchar(stridl)
|
409
|
+
end
|
410
|
+
else
|
411
|
+
error_lex('malformed number'..is_near_value(tokenvalue))
|
412
|
+
end
|
413
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
414
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
415
|
+
return token
|
416
|
+
elseif (lookahead == 'd' or lookahead == 'D') then
|
417
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
418
|
+
lookahead = getchar(stridl)
|
419
|
+
token = tab_tokens.TK_FIXED_LITERAL
|
420
|
+
return token
|
421
|
+
else
|
422
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
423
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
424
|
+
return token
|
425
|
+
end
|
426
|
+
else
|
427
|
+
tokenvalue = '.'
|
428
|
+
token = tokenvalue
|
429
|
+
return token
|
430
|
+
end
|
431
|
+
-- integer literal (decimal)
|
432
|
+
-- integer literal (hexa)
|
433
|
+
-- integer literal (octal)
|
434
|
+
-- floating-point literals
|
435
|
+
-- fixed-point literals
|
436
|
+
elseif (lookahead == '0') then
|
437
|
+
tokenvalue = '0'
|
438
|
+
lookahead = getchar(stridl)
|
439
|
+
if (lookahead == 'x' or lookahead == 'X') then
|
440
|
+
tokenvalue = tokenvalue..lookahead
|
441
|
+
lookahead = getchar(stridl)
|
442
|
+
while is_hex_digit(lookahead) do
|
443
|
+
tokenvalue = tokenvalue..lookahead
|
444
|
+
lookahead = getchar(stridl)
|
445
|
+
end
|
446
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
447
|
+
token = tab_tokens.TK_INTEGER_LITERAL
|
448
|
+
return token
|
449
|
+
end
|
450
|
+
while is_digit(lookahead) do
|
451
|
+
tokenvalue = tokenvalue..lookahead
|
452
|
+
lookahead = getchar(stridl)
|
453
|
+
end
|
454
|
+
if (lookahead == '.' or lookahead == 'e' or lookahead == 'E' or
|
455
|
+
lookahead == 'd' or lookahead == 'd')
|
456
|
+
then
|
457
|
+
if (lookahead == '.') then
|
458
|
+
tokenvalue = tokenvalue..'.'
|
459
|
+
lookahead = getchar(stridl)
|
460
|
+
if is_digit(lookahead) then
|
461
|
+
tokenvalue = tokenvalue..lookahead
|
462
|
+
lookahead = getchar(stridl)
|
463
|
+
while is_digit(lookahead) do
|
464
|
+
tokenvalue = tokenvalue..lookahead
|
465
|
+
lookahead = getchar(stridl)
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
if (lookahead == 'e' or lookahead == 'E') then
|
470
|
+
tokenvalue = tokenvalue..lookahead
|
471
|
+
lookahead = getchar(stridl)
|
472
|
+
if (lookahead == '-') then
|
473
|
+
tokenvalue = tokenvalue..lookahead
|
474
|
+
lookahead = getchar(stridl)
|
475
|
+
if not is_digit(lookahead) then
|
476
|
+
error_lex('malformed number near'..is_near_value(tokenvalue))
|
477
|
+
else
|
478
|
+
tokenvalue = tokenvalue..lookahead
|
479
|
+
lookahead = getchar(stridl)
|
480
|
+
while is_digit(lookahead) do
|
481
|
+
tokenvalue = tokenvalue..lookahead
|
482
|
+
lookahead = getchar(stridl)
|
483
|
+
end
|
484
|
+
end
|
485
|
+
elseif is_digit(lookahead) then
|
486
|
+
tokenvalue = tokenvalue..lookahead
|
487
|
+
lookahead = getchar(stridl)
|
488
|
+
while is_digit(lookahead) do
|
489
|
+
tokenvalue = tokenvalue..lookahead
|
490
|
+
lookahead = getchar(stridl)
|
491
|
+
end
|
492
|
+
else
|
493
|
+
error_lex('malformed number near'..is_near_value(tokenvalue))
|
494
|
+
end
|
495
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
496
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
497
|
+
return token
|
498
|
+
elseif (lookahead == 'd' or lookahead == 'D') then
|
499
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
500
|
+
lookahead = getchar(stridl)
|
501
|
+
token = tab_tokens.TK_FIXED_LITERAL
|
502
|
+
return token
|
503
|
+
else
|
504
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
505
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
506
|
+
return token
|
507
|
+
end
|
508
|
+
else
|
509
|
+
if not (string.find(tokenvalue, '8') or string.find(tokenvalue, '9')) then
|
510
|
+
tokenvalue = tonumber(tokenvalue, 8)
|
511
|
+
end
|
512
|
+
token = tab_tokens.TK_INTEGER_LITERAL
|
513
|
+
return token
|
514
|
+
end
|
515
|
+
-- integer literal (decimal)
|
516
|
+
-- floating-point literals
|
517
|
+
-- fixed-point literals
|
518
|
+
elseif is_digit(lookahead) then
|
519
|
+
tokenvalue = lookahead
|
520
|
+
lookahead = getchar(stridl)
|
521
|
+
while is_digit(lookahead) do
|
522
|
+
tokenvalue = tokenvalue..lookahead
|
523
|
+
lookahead = getchar(stridl)
|
524
|
+
end
|
525
|
+
if (lookahead == '.' or lookahead == 'e' or lookahead == 'E' or
|
526
|
+
lookahead == 'd' or lookahead == 'd')
|
527
|
+
then
|
528
|
+
if (lookahead == '.') then
|
529
|
+
tokenvalue = tokenvalue..'.'
|
530
|
+
lookahead = getchar(stridl)
|
531
|
+
if is_digit(lookahead) then
|
532
|
+
tokenvalue = tokenvalue..lookahead
|
533
|
+
lookahead = getchar(stridl)
|
534
|
+
while is_digit(lookahead) do
|
535
|
+
tokenvalue = tokenvalue..lookahead
|
536
|
+
lookahead = getchar(stridl)
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
if (lookahead == 'e' or lookahead == 'E') then
|
541
|
+
tokenvalue = tokenvalue..lookahead
|
542
|
+
lookahead = getchar(stridl)
|
543
|
+
if (lookahead == '-') then
|
544
|
+
tokenvalue = tokenvalue..lookahead
|
545
|
+
lookahead = getchar(stridl)
|
546
|
+
if not is_digit(lookahead) then
|
547
|
+
error_lex('malformed number near'..is_near_value(tokenvalue))
|
548
|
+
else
|
549
|
+
tokenvalue = tokenvalue..lookahead
|
550
|
+
lookahead = getchar(stridl)
|
551
|
+
while is_digit(lookahead) do
|
552
|
+
tokenvalue = tokenvalue..lookahead
|
553
|
+
lookahead = getchar(stridl)
|
554
|
+
end
|
555
|
+
end
|
556
|
+
elseif is_digit(lookahead) then
|
557
|
+
tokenvalue = tokenvalue..lookahead
|
558
|
+
lookahead = getchar(stridl)
|
559
|
+
while is_digit(lookahead) do
|
560
|
+
tokenvalue = tokenvalue..lookahead
|
561
|
+
lookahead = getchar(stridl)
|
562
|
+
end
|
563
|
+
else
|
564
|
+
error_lex('malformed number near'..is_near_value(tokenvalue))
|
565
|
+
end
|
566
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
567
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
568
|
+
return token
|
569
|
+
elseif (lookahead == 'd' or lookahead == 'D') then
|
570
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
571
|
+
lookahead = getchar(stridl)
|
572
|
+
token = tab_tokens.TK_FIXED_LITERAL
|
573
|
+
return token
|
574
|
+
else
|
575
|
+
tokenvalue = tonumber(tokenvalue, 10)
|
576
|
+
token = tab_tokens.TK_FLOAT_LITERAL
|
577
|
+
return token
|
578
|
+
end
|
579
|
+
else
|
580
|
+
token = tab_tokens.TK_INTEGER_LITERAL
|
581
|
+
return token
|
582
|
+
end
|
583
|
+
-- char literal
|
584
|
+
-- "The value of a null is 0" ????
|
585
|
+
elseif (lookahead == '\'') then
|
586
|
+
tokenvalue = ''
|
587
|
+
lookahead = getchar(stridl)
|
588
|
+
if (lookahead == '\\') then
|
589
|
+
lookahead = getchar(stridl)
|
590
|
+
if (lookahead == 'n') then
|
591
|
+
tokenvalue = tokenvalue..'\n'
|
592
|
+
lookahead = getchar(stridl)
|
593
|
+
elseif (lookahead == 't') then
|
594
|
+
tokenvalue = tokenvalue..'\t'
|
595
|
+
lookahead = getchar(stridl)
|
596
|
+
elseif (lookahead == 'v') then
|
597
|
+
tokenvalue = tokenvalue..'\v'
|
598
|
+
lookahead = getchar(stridl)
|
599
|
+
elseif (lookahead == 'b') then
|
600
|
+
tokenvalue = tokenvalue..'\b'
|
601
|
+
lookahead = getchar(stridl)
|
602
|
+
elseif (lookahead == 'r') then
|
603
|
+
tokenvalue = tokenvalue..'\r'
|
604
|
+
lookahead = getchar(stridl)
|
605
|
+
elseif (lookahead == 'f') then
|
606
|
+
tokenvalue = tokenvalue..'\f'
|
607
|
+
lookahead = getchar(stridl)
|
608
|
+
elseif (lookahead == 'a') then
|
609
|
+
tokenvalue = tokenvalue..'\a'
|
610
|
+
lookahead = getchar(stridl)
|
611
|
+
elseif (lookahead == '\\') then
|
612
|
+
tokenvalue = tokenvalue..'\\'
|
613
|
+
lookahead = getchar(stridl)
|
614
|
+
elseif (lookahead == '?') then
|
615
|
+
tokenvalue = tokenvalue..'?'
|
616
|
+
lookahead = getchar(stridl)
|
617
|
+
elseif (lookahead == '\'') then
|
618
|
+
tokenvalue = tokenvalue..'\''
|
619
|
+
lookahead = getchar(stridl)
|
620
|
+
elseif (lookahead == '"') then
|
621
|
+
tokenvalue = tokenvalue..'"'
|
622
|
+
lookahead = getchar(stridl)
|
623
|
+
elseif is_octal_digit(lookahead) then
|
624
|
+
local num_digits = 1
|
625
|
+
local tokenvalue_tmp = lookahead
|
626
|
+
lookahead = getchar(stridl)
|
627
|
+
while is_octal_digit(lookahead) do
|
628
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
629
|
+
lookahead = getchar(stridl)
|
630
|
+
num_digits = num_digits + 1
|
631
|
+
if (num_digits == 3) then
|
632
|
+
lookahed = getchar(stridl)
|
633
|
+
break
|
634
|
+
end
|
635
|
+
end
|
636
|
+
tokenvalue = tokenvalue..string.char(tonumber(tokenvalue_tmp, 8))
|
637
|
+
elseif (lookahead == 'x') then
|
638
|
+
local tokenvalue_tmp = '0x'
|
639
|
+
lookahead = getchar(stridl)
|
640
|
+
if is_hex_digit(lookahead) then
|
641
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
642
|
+
lookahead = getchar(stridl)
|
643
|
+
if is_hex_digit(lookahead) then
|
644
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
645
|
+
lookahead = getchar(stridl)
|
646
|
+
end
|
647
|
+
end
|
648
|
+
tokenvalue = tokenvalue..string.char(tonumber(tokenvalue_tmp, 10))
|
649
|
+
elseif (lookahead == 'u') then
|
650
|
+
error_lex('it doest not permited unicode characters in char type')
|
651
|
+
else
|
652
|
+
-- When occur an unknown escape sequence, then we apply a common
|
653
|
+
-- behavior that is to return a proper character. Ex.: '\e' -> e
|
654
|
+
tokenvalue = tokenvalue..lookahead
|
655
|
+
lookahead = getchar(stridl)
|
656
|
+
end
|
657
|
+
elseif (lookahead ~= '\'') then
|
658
|
+
tokenvalue = lookahead
|
659
|
+
lookahead = getchar(stridl)
|
660
|
+
end
|
661
|
+
if (lookahead ~= '\'') then
|
662
|
+
if not lookahead then
|
663
|
+
error_lex('"\'" expected near \'<eof>\'')
|
664
|
+
else
|
665
|
+
error_lex('"\'" expected'..is_near_value(tokenvalue))
|
666
|
+
end
|
667
|
+
end
|
668
|
+
lookahead = getchar(stridl)
|
669
|
+
token = tab_tokens.TK_CHAR_LITERAL
|
670
|
+
return token
|
671
|
+
-- string literal
|
672
|
+
elseif (lookahead == '"') then
|
673
|
+
lookahead = getchar(stridl)
|
674
|
+
tokenvalue = ''
|
675
|
+
while true do
|
676
|
+
if (lookahead == '\\') then
|
677
|
+
lookahead = getchar(stridl)
|
678
|
+
if (lookahead == 'n') then
|
679
|
+
tokenvalue = tokenvalue..'\n'
|
680
|
+
lookahead = getchar(stridl)
|
681
|
+
elseif (lookahead == 't') then
|
682
|
+
tokenvalue = tokenvalue..'\t'
|
683
|
+
lookahead = getchar(stridl)
|
684
|
+
elseif (lookahead == 'v') then
|
685
|
+
tokenvalue = tokenvalue..'\v'
|
686
|
+
lookahead = getchar(stridl)
|
687
|
+
elseif (lookahead == 'b') then
|
688
|
+
tokenvalue = tokenvalue..'\b'
|
689
|
+
lookahead = getchar(stridl)
|
690
|
+
elseif (lookahead == 'r') then
|
691
|
+
tokenvalue = tokenvalue..'\r'
|
692
|
+
lookahead = getchar(stridl)
|
693
|
+
elseif (lookahead == 'f') then
|
694
|
+
tokenvalue = tokenvalue..'\f'
|
695
|
+
lookahead = getchar(stridl)
|
696
|
+
elseif (lookahead == 'a') then
|
697
|
+
tokenvalue = tokenvalue..'\a'
|
698
|
+
lookahead = getchar(stridl)
|
699
|
+
elseif (lookahead == '\\') then
|
700
|
+
tokenvalue = tokenvalue..'\\'
|
701
|
+
lookahead = getchar(stridl)
|
702
|
+
elseif (lookahead == '?') then
|
703
|
+
tokenvalue = tokenvalue..'?'
|
704
|
+
lookahead = getchar(stridl)
|
705
|
+
elseif (lookahead == '\'') then
|
706
|
+
tokenvalue = tokenvalue..'\''
|
707
|
+
lookahead = getchar(stridl)
|
708
|
+
elseif (lookahead == '"') then
|
709
|
+
tokenvalue = tokenvalue..'"'
|
710
|
+
lookahead = getchar(stridl)
|
711
|
+
elseif is_octal_digit(lookahead) then
|
712
|
+
local num_digits = 1
|
713
|
+
local tokenvalue_tmp = lookahead
|
714
|
+
lookahead = getchar(stridl)
|
715
|
+
while is_octal_digit(lookahead) do
|
716
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
717
|
+
lookahead = getchar(stridl)
|
718
|
+
num_digits = num_digits + 1
|
719
|
+
if (num_digits == 3) then
|
720
|
+
lookahed = getchar(stridl)
|
721
|
+
break
|
722
|
+
end
|
723
|
+
end
|
724
|
+
tokenvalue = tokenvalue..string.char(tonumber(tokenvalue_tmp, 8))
|
725
|
+
elseif (lookahead == 'x') then
|
726
|
+
local tokenvalue_tmp = '0x'
|
727
|
+
lookahead = getchar(stridl)
|
728
|
+
if is_hex_digit(lookahead) then
|
729
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
730
|
+
lookahead = getchar(stridl)
|
731
|
+
if is_hex_digit(lookahead) then
|
732
|
+
tokenvalue_tmp = tokenvalue_tmp..lookahead
|
733
|
+
lookahead = getchar(stridl)
|
734
|
+
end
|
735
|
+
end
|
736
|
+
tokenvalue = tokenvalue..string.char(tonumber(tokenvalue_tmp, 10))
|
737
|
+
elseif (lookahead == 'u') then
|
738
|
+
error_lex('it doest not permited unicode characters in char type')
|
739
|
+
else
|
740
|
+
-- When occur an unknown escape sequence, then we apply a common
|
741
|
+
-- behavior that is to return a proper character. Ex.: '\e' -> e
|
742
|
+
tokenvalue = tokenvalue..lookahead
|
743
|
+
lookahead = getchar(stridl)
|
744
|
+
end
|
745
|
+
elseif (lookahead == '"') then
|
746
|
+
break
|
747
|
+
elseif not lookahead then
|
748
|
+
error_lex('nonterminated string')
|
749
|
+
else
|
750
|
+
tokenvalue = tokenvalue..lookahead
|
751
|
+
lookahead = getchar(stridl)
|
752
|
+
end
|
753
|
+
end
|
754
|
+
lookahead = getchar(stridl)
|
755
|
+
token = tab_tokens.TK_STRING_LITERAL
|
756
|
+
return token
|
757
|
+
-- identifiers
|
758
|
+
-- keywords
|
759
|
+
elseif (is_alpha(lookahead) or (lookahead == '_')) then
|
760
|
+
local lexbuf = lookahead
|
761
|
+
lookahead = getchar(stridl)
|
762
|
+
while is_alpha(lookahead) or (lookahead == '_') or is_digit(lookahead) do
|
763
|
+
lexbuf = lexbuf..lookahead
|
764
|
+
lookahead = getchar(stridl)
|
765
|
+
end
|
766
|
+
-- Escaped identifiers - turns off keyword checking.
|
767
|
+
if (string.sub(lexbuf, 1, 1) == '_') then
|
768
|
+
lexbuf = string.sub(lexbuf, 2)
|
769
|
+
else
|
770
|
+
tokenvalue, _token = validate_symbol(lexbuf, tab_keywords)
|
771
|
+
if (_token == "collide") then
|
772
|
+
error_lex("'"..lexbuf.."' collides with keyword '"..tokenvalue.."'")
|
773
|
+
elseif _token then
|
774
|
+
token = _token
|
775
|
+
return token
|
776
|
+
end
|
777
|
+
end
|
778
|
+
tokenvalue, token = search_symbol(lexbuf, tab_symbols)
|
779
|
+
if not token then
|
780
|
+
insert_symbols(lexbuf)
|
781
|
+
tokenvalue = lexbuf
|
782
|
+
token = tab_tokens.TK_ID
|
783
|
+
end
|
784
|
+
return token
|
785
|
+
-- operators and other characters
|
786
|
+
else
|
787
|
+
tokenvalue = lookahead
|
788
|
+
lookahead = getchar(stridl)
|
789
|
+
token = tokenvalue
|
790
|
+
return token
|
791
|
+
end
|
792
|
+
end
|
793
|
+
end
|