Skip to content

Commit

Permalink
Enabling the tokenizer to accept files
Browse files Browse the repository at this point in the history
  • Loading branch information
kristopolous committed Jun 25, 2016
1 parent 6be75a3 commit e9d69b5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ticktick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,19 @@ __tick_fun_parse() {
# can be passed a path to be interpreted or, if that is not passed
# it figures out the caller and just does the same thing
__tick_fun_tokenize() {
if [ $# -eq "0" ]; then
__tick_fun_tokenize "$(caller 1 | cut -d ' ' -f 3)"
fi
local fname="$1"

# This makes sure that when we rerun the code that we are
# interpreting, we don't try to interpret it again.
export __tick_var_tokenized=1

# Using bash's caller function, which is for debugging, we
# can find out the name of the program that called us. We
# then cat the calling program and push it through our parser
local code=$(cat `caller 1 | cut -d ' ' -f 3` | __tick_fun_parse)
local code=$(cat $fname | __tick_fun_parse)

# Before the execution we search to see if we emitted any parsing errors
hasError=`echo "$code" | $GREP "TICKTICK PARSING ERROR" | wc -l`
Expand Down Expand Up @@ -365,8 +370,8 @@ __tick_fun_tokenize() {
enable -n source
enable -n .
source() {
echo "loading "$1
tickParse "$1"
# echo "loading "$1
builtin . "$1"
}
.() {
source "$1"
Expand Down

0 comments on commit e9d69b5

Please sign in to comment.