From 09d8a06f9e520b7bc07a199e52d3997edf3153d7 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 17 May 2024 10:34:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=80=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D0=BD=D0=BE=D0=B5=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B8=D0=BF=D0=B0?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/files.tcl | 16 ++++++++++------ lib/lexers.tcl | 4 ++++ projman.tcl | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/files.tcl b/lib/files.tcl index 430e1e4..dd668d8 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -31,7 +31,8 @@ namespace eval FileOper { # lappend cmd $activeProject lappend cmd $fileFullPath - catch $cmd pipe + # puts $cmd + catch $cmd pipe # puts $pipe if [regexp -nocase -- {(\w+)/([\w\-_\.]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { puts "$fType $fExt $fCharset" @@ -43,11 +44,14 @@ namespace eval FileOper { } } } + # линуксовый file не всегда корректно определяет тип файла + # используем пакет из tcl + lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp + puts "File type is $fType, $fBinaryType, $fBinaryInterp" + switch $fType { - "application" { - if {$fExt ne "json"} { - return false - } + "binary" { + return false } "text" { return text @@ -393,7 +397,7 @@ namespace eval FileOper { if {[file exists $fileFullPath] == 0} { return false } else { - # puts [::fileutil::magic::filetype $fileFullPath] + puts "$fileFullPath File type [::fileutil::magic::filetype $fileFullPath]" set fileType [FileOper::GetFileMimeType $fileFullPath] } switch $fileType { diff --git a/lib/lexers.tcl b/lib/lexers.tcl index ec0bc8a..6c58248 100644 --- a/lib/lexers.tcl +++ b/lib/lexers.tcl @@ -20,6 +20,7 @@ dict set lexers GO commentMultilineSymbolEnd {*/} dict set lexers GO procFindString {func.*?PROCNAME} dict set lexers GO procRegexpCommand {regexp -nocase -all -- {\s*?func\s*?(\(\w+\s*?\**?\w+\)|)\s*?(\w+)\((.*?)\)\s+?([a-zA-Z0-9\{\}\[\]\(\)-_.]*?|)\s*?\{} $line match linkName procName params returns} dict set lexers GO varRegexpCommand {regexp -nocase -all -line -- {^\s*?var\s+([a-zA-Z0-9\-_$]+)\s+(.+?)(\s*$)} $line match varName varType lineEnd} + #-------------------------------------------------- # SHELL (Bash) dict set lexers SH commentSymbol {#} @@ -43,6 +44,7 @@ dict set lexers RB tabSize 2 dict set lexers RB procFindString {(def |class )\s*?PROCNAME} dict set lexers RB procRegexpCommand {regexp -nocase -all -- {^\s*?(def|class)\s([a-zA-Z0-9\-_:\?]+?)($|\s|\(.+?\))} $line match keyWord procName params} dict set lexers RB varRegexpCommand {regexp -nocase -all -line -- {^\s*?(\w+)\s*=\s*(.+)($)} $line match varName varValue lineEnd} + #-------------------------------------------------- # YAML (ansible) dict set lexers YML commentSymbol {#} @@ -95,6 +97,8 @@ dict set lexers HTM tabSize 4 dict set lexers HTM procFindString {(<.+>|)PROCNAME(|)} dict set lexers HTM procRegexpCommand {regexp -nocase -all -- {(<.+>|)(.+?)(|)} $line match v1 procName v2} +#-------------------------------------------------- +# LUA dict set lexers LUA commentSymbol {--} dict set lexers LUA procFindString {function\s*?PROCNAME} dict set lexers LUA procRegexpCommand {regexp -nocase -all -- {^(local|)\s*?(function)\s([a-zA-Z0-9\-_:]+?)\s+\((.+?)\)} $line match v1 keyWord procName params} diff --git a/projman.tcl b/projman.tcl index 4b17874..a2d26dd 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 27072023125916 +# Build: 17052024103352 ###################################################### # определим текущую версию, релиз и т.д.