(args)
return 0
Run the listtokens tool.

    Args:
      args: The argparser parsed args object.

    Returns:
      0 on success, 1 on failure.
Run the listtokens tool.
Run the listtokens tool .
def listtokens(args):
    """Run the listtokens tool.

    Args:
      args: The argparser parsed args object.

    Returns:
      0 on success, 1 on failure.
    """
    for fname, g in _games_for_filenames(args.filename):
        if g is None:
            util.error('{}: could not load cart\n'.format(fname))
            if len(args.filename) == 1:
                return 1
            continue
        if len(args.filename) > 1:
            util.write('=== {} ===\n'.format(g.filename))
        pos = 0
        for t in g.lua.tokens:
            if isinstance(t, lexer.TokNewline):
                util.write('\n')
            elif (isinstance(t, lexer.TokSpace) or
                  isinstance(t, lexer.TokComment)):
                util.write('<{}>'.format(t.value))
            else:
                util.write('<{}:{}>'.format(pos, t.value))
                pos += 1
        util.write('\n')
    return 0
def listtokens ( args ) : for fname , g in _games_for_filenames ( args . filename ) : if g is None : util . error ( '{}: could not load cart\n' . format ( fname ) ) if len ( args . filename ) == 1 : return 1 continue if len ( args . filename ) > 1 : util . write ( '=== {} ===\n' . format ( g . filename ) ) pos = 0 for t in g . lua . tokens : if isinstance ( t , lexer . TokNewline ) : util . write ( '\n' ) elif ( isinstance ( t , lexer . TokSpace ) or isinstance ( t , lexer . TokComment ) ) : util . write ( '<{}>' . format ( t . value ) ) else : util . write ( '<{}:{}>' . format ( pos , t . value ) ) pos += 1 util . write ( '\n' ) return 0