Esempio n. 1
0
        private static LScript ImportMetaTags(LScript meta_tag)
        {
            if (meta_tag.Word != "#IMPORT")
            {
                return(null);
            }
            string file_name = meta_tag as TokenLS <string>;

            if (file_name == null)
            {
                return(null);
            }
            CreateFrom(File.ReadAllText(file_name));
            return(null);
        }
Esempio n. 2
0
        private static LScript DoMetaMath(LScript meta_tag)
        {
            if (meta_tag.Word != "#MATH")
            {
                return(null);
            }
            var    meta_complex = meta_tag as ComplexLS;
            double sum          = 0.0;
            string name         = null;

            foreach (var script in meta_complex.SubRunes)
            {
                sum = DoMath(script, sum, out string fnd_name);
                if (fnd_name != string.Empty)
                {
                    name = fnd_name;
                }
            }
            return(new TokenLS <double>(name, sum));
        }
Esempio n. 3
0
        private static double DoMath(LScript operation, double sum, out string found_name)
        {
            var tok = operation as TokenLS <double>;

            found_name = string.Empty;
            switch (operation.Word)
            {
            case "IS": return(tok.Value);

            case "MINUS": return(sum - tok.Value);

            case "PLUS": return(sum + tok.Value);

            case "DIVIDE": return(sum - tok.Value);

            case "TIMES": return(sum + tok.Value);

            default:
                found_name = operation.Word;
                return(sum);
            }
        }