<commit_before># Copyright (C) 2006-2008, The Perl Foundation.
# $Id$

=head1 NAME

test_lex -- A dumper for Lua 5.1 lexicography

=head1 SYNOPSIS

  $ parrot test_lex.pir script.lua
  $ parrot test_lex.pir --target=parse script.lua
                                 PAST
                                 POST
                                 PIR

=head1 DESCRIPTION

This compiler is a C<PCT::HLLCompiler>,
see F<compilers/pct/src/PCT/HLLCompiler.pir>)

This compiler defines the following stages:

=over 4

=item * parse F<languages/lua/src/lua51_testlex.pg>

=item * past  F<languages/lua/src/dumplex.tg>

=back

and imports many definitions from the full Lua compiler
(F<languages/lua/src/lua51.pir>).

=cut

.sub '__onload' :anon :load :init
    load_bytecode 'languages/lua/lua.pbc'

    $P0 = new ['PCT';'HLLCompiler']
    $P0.'language'('LuaTestLex')
    $P0.'parsegrammar'('Lua::TestLex')
    $P0.'astgrammar'('Lua::DumpLex')

    $S0 = "Lexico of Lua 5.1 on Parrot  Copyright (C) 2005-2008, The Perl Foundation.\n"
    $P0.'commandline_banner'($S0)
    $P0.'commandline_prompt'('> ')

    # import Lua::Grammar::* into Lua::TestLex
    $P0 = get_hll_global ['Lua';'Grammar'], 'string'
    set_hll_global ['Lua';'TestLex'], 'String', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'ws'
    set_hll_global ['Lua';'TestLex'], 'ws', $P0

    $P0 = get_hll_global ['Lua';'Grammar'], 'syntaxerror'
    set_hll_global ['Lua';'TestLex'], 'die', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'Name'
    set_hll_global ['Lua';'TestLex'], 'Name', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'number'
    set_hll_global ['Lua';'TestLex'], 'Number', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'quoted_literal'
    set_hll_global ['Lua';'TestLex'], 'quoted_literal', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'long_string'
    set_hll_global ['Lua';'TestLex'], 'long_string', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'long_comment'
    set_hll_global ['Lua';'TestLex'], 'long_comment', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'shebang'
    set_hll_global ['Lua';'TestLex'], 'shebang', $P0

    # import Lua::PAST::Grammar::internal_error into Lua::DumpLex
    $P0 = get_hll_global ['Lua';'PAST';'Grammar'], 'internal_error'
    set_hll_global ['Lua';'DumpLex'], 'internal_error', $P0
.end

.sub 'main' :anon :main
    .param pmc args
    $P0 = compreg 'LuaTestLex'
    $P0.'command_line'(args)
.end

.include 'languages/lua/src/dumplex_gen.pir'
.include 'languages/lua/src/lua51_testlex_gen.pir'

.namespace []

.sub 'println'<commit_msg>[Lua] - fix TestLex (Cannot find TOP regex in Lua::TestLex)<commit_after># Copyright (C) 2006-2008, The Perl Foundation.
# $Id$

=head1 NAME

test_lex -- A dumper for Lua 5.1 lexicography

=head1 SYNOPSIS

  $ parrot test_lex.pir script.lua
  $ parrot test_lex.pir --target=parse script.lua
                                 PAST
                                 POST
                                 PIR

=head1 DESCRIPTION

This compiler is a C<PCT::HLLCompiler>,
see F<compilers/pct/src/PCT/HLLCompiler.pir>)

This compiler defines the following stages:

=over 4

=item * parse F<languages/lua/src/lua51_testlex.pg>

=item * past  F<languages/lua/src/dumplex.tg>

=back

and imports many definitions from the full Lua compiler
(F<languages/lua/src/lua51.pir>).

=cut

.sub '__onload' :anon :load :init
    load_bytecode 'PCT.pbc'

    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
    $P0 = $P0.'new'()
    $P0.'language'('LuaTestLex')
    $P0.'parsegrammar'('Lua::TestLex')
    $P0.'astgrammar'('Lua::DumpLex')

    $S0 = "Lexico of Lua 5.1 on Parrot\nCopyright (C) 2005-2008, The Perl Foundation.\n"
    $P0.'commandline_banner'($S0)
    $P0.'commandline_prompt'('> ')

    # import Lua::Grammar::* into Lua::TestLex
    $P0 = get_hll_global ['Lua';'Grammar'], 'string'
    set_hll_global ['Lua';'TestLex'], 'String', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'ws'
    set_hll_global ['Lua';'TestLex'], 'ws', $P0

    $P0 = get_hll_global ['Lua';'Grammar'], 'syntaxerror'
    set_hll_global ['Lua';'TestLex'], 'die', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'Name'
    set_hll_global ['Lua';'TestLex'], 'Name', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'number'
    set_hll_global ['Lua';'TestLex'], 'Number', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'quoted_literal'
    set_hll_global ['Lua';'TestLex'], 'quoted_literal', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'long_string'
    set_hll_global ['Lua';'TestLex'], 'long_string', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'long_comment'
    set_hll_global ['Lua';'TestLex'], 'long_comment', $P0
    $P0 = get_hll_global ['Lua';'Grammar'], 'shebang'
    set_hll_global ['Lua';'TestLex'], 'shebang', $P0

    # import Lua::PAST::Grammar::internal_error into Lua::DumpLex
    $P0 = get_hll_global ['Lua';'PAST';'Grammar'], 'internal_error'
    set_hll_global ['Lua';'DumpLex'], 'internal_error', $P0
.end

.sub 'main' :anon :main
    .param pmc args
    $P0 = compreg 'LuaTestLex'
    $P0.'command_line'(args)
.end

.include 'languages/lua/src/dumplex_gen.pir'
.include 'languages/lua/src/lua51_testlex_gen.pir'
.include 'languages/lua/src/grammar51.pir'
.include 'languages/lua/src/lua51_gen.pir'

.namespace []

.sub 'println'
{'fraction_non_alphanumeric': 0.17259651778955337, 'fraction_numerical': 0.02384557153671461, 'mean_word_length': 3.748427672955975, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5971587', 'n_tokens_mistral': 2261, 'n_tokens_neox': 2135, 'n_words': 414}