<commit_before>@prefix u "http://www.genyris.org/lang/utilities#"
@prefix ver "http://www.genyris.org/lang/version#"
@prefix sys "http://www.genyris.org/lang/system#"
@prefix java 'http://www.genyris.org/lang/java#'

import versioninfo

def sys:print-classnames(obj)
    define klasses (use obj (the .classes))
    while klasses
        u:format '%a ' ((left klasses).classname)
        setq klasses (cdr klasses)
 
def sys:printBackTrace(bt)
   # setq bt (cdr (cdr bt))
   while bt
       print (left bt)
       setq bt (cdr bt)

def sys:read-eval-print-loop()
   u:format "*** Welcome %a, %a version %a, home %a is listening...%n"
        (os(.getProperties)).|user.name|
        versioninfo.title
        versioninfo.version
        System.HOME
   define looping true          
   while looping
       define bt nil
       catch (errors bt)
           define expression (read true)
           define result (eval expression)
       cond
           errors
               u:format "*** Error - %s\n" errors
               sys:printBackTrace bt
               setq bt nil             
           else
                cond
                    (equal? result EOF)
                        setq looping nil
                u:format '%s # ' result
                sys:print-classnames result
                u:format '\n'
<commit_msg>Fix for issue #64 REPL loosing prefixes. https://code.google.com/p/genyris/issues/detail?id=64<commit_after>@prefix u "http://www.genyris.org/lang/utilities#"
@prefix ver "http://www.genyris.org/lang/version#"
@prefix sys "http://www.genyris.org/lang/system#"
@prefix java 'http://www.genyris.org/lang/java#'

import versioninfo

def sys:print-classnames(obj)
    define klasses (use obj (the .classes))
    while klasses
        u:format '%a ' ((left klasses).classname)
        setq klasses (cdr klasses)
 
def sys:printBackTrace(bt)
   # setq bt (cdr (cdr bt))
   while bt
       print (left bt)
       setq bt (cdr bt)

def sys:read-eval-print-loop()
   u:format "*** Welcome %a, %a version %a, home %a is listening...%n"
        (os(.getProperties)).|user.name|
        versioninfo.title
        versioninfo.version
        System.HOME
   define looping true
   define parser (IndentedParser(.new stdin true))
   parser
      .prefix ^sys "http://www.genyris.org/lang/system#"
      .prefix ^u "http://www.genyris.org/lang/utilities#"
      .prefix ^java 'http://www.genyris.org/lang/java#'            
   while looping
       define bt nil
       catch (errors bt)
           define expression (parser (.read))
           define result (eval expression)
       cond
           errors
               u:format "*** Error - %s\n" errors
               sys:printBackTrace bt
               setq bt nil             
           else
                cond
                    (equal? result EOF)
                        setq looping nil
                u:format '%s # ' result
                sys:print-classnames result
                u:format '\n'

{'fraction_non_alphanumeric': 0.11517797179314976, 'fraction_numerical': 0.001343183344526528, 'mean_word_length': 1.8077285579641846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 11, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7037030', 'n_tokens_mistral': 920, 'n_tokens_neox': 898, 'n_words': 240}