Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matefun
Frontend
Commits
3ff23a41
Commit
3ff23a41
authored
Feb 21, 2019
by
Franco Pariani
Browse files
Typing from included files
parent
105e962a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_EN.js
View file @
3ff23a41
...
...
@@ -26,8 +26,9 @@ var mac = /Mac/.test(navigator.platform);
return
out
;
}
function
Completion
(
cm
,
options
,
filename
)
{
function
Completion
(
cm
,
options
,
filename
,
archivos
)
{
this
.
filename
=
filename
;
this
.
archivos
=
archivos
;
this
.
cm
=
cm
;
this
.
options
=
options
;
this
.
widget
=
null
;
...
...
@@ -196,7 +197,7 @@ var mac = /Mac/.test(navigator.platform);
var
rexp_name
=
new
RegExp
(
/
(
.*
\:\:)(
.*
)
/
.
source
,
"
g
"
);
var
m
=
rexp_name
.
exec
(
cur
.
displayText
||
getText
(
cur
));
var
b_elem
=
ownerDocument
.
createElement
(
"
b
"
);
b_elem
.
appendChild
(
ownerDocument
.
createTextNode
(
(
hintWords
.
EN_typed_functions
().
indexOf
(
m
[
1
]
+
m
[
2
])
==
-
1
?
(
completion
.
filename
+
'
.
'
)
:
""
)
+
m
[
1
]));
b_elem
.
appendChild
(
ownerDocument
.
createTextNode
(
m
[
1
]));
elt
.
appendChild
(
b_elem
);
elt
.
appendChild
(
ownerDocument
.
createTextNode
(
m
[
2
]));
}
...
...
@@ -411,22 +412,15 @@ var mac = /Mac/.test(navigator.platform);
var
WORD
=
/
[\w
$
]
+/
;
var
RANGE
=
500
;
var
SET
=
/set
\s
+
([\w\_\d]
+
)\s
*
\=
/
;
var
DOM
=
/
\:\:
/
;
var
FUNS
=
/
([\w\_\d]
+
)\s
+
\:\:
/
;
var
COMPLETE_FUNS
=
/
([\w\_\d\-]
+
)(\s
+
\:\:
.*
)
/
;
var
FUN
=
/
([\w\_\d]
+
)\s
*
\(([\,\w\_\s\d]
*
)\)\s
*
\=
/
;
var
ENUMS
=
/set
\s
+
[\w\_\d]
+
\s
*
\=\s
*
\{(
.*
?)\}
/
;
var
WRITING_SET
=
/set
\s
/
;
var
WRITING_COMMENT
=
/
\{\-
/
;
// functions definitions
CodeMirror
.
defineExtension
(
"
functionDefinition
"
,
function
(
filename
,
options
)
{
CodeMirror
.
defineExtension
(
"
functionDefinition
"
,
function
(
filename
,
archivos
,
options
)
{
if
(
options
.
mode
.
name
==
"
matefun-EN
"
){
options
=
parseOptions
(
this
,
this
.
getCursor
(
"
start
"
),
options
);
if
(
this
.
state
.
completionActive
)
this
.
state
.
completionActive
.
close
();
var
completion
=
this
.
state
.
completionActive
=
new
Completion
(
this
,
options
,
filename
);
var
completion
=
this
.
state
.
completionActive
=
new
Completion
(
this
,
options
,
filename
,
archivos
);
CodeMirror
.
signal
(
this
,
"
startFunctionDefinition
"
,
this
);
completion
.
update
(
true
);
...
...
@@ -437,6 +431,8 @@ var mac = /Mac/.test(navigator.platform);
if
(
this
.
state
.
completionActive
)
this
.
state
.
completionActive
.
close
()
})
var
INCLUIR
=
/include
\s
+
([\w\_\d]
+
)
/
;
function
functionDefinition
(
editor
,
options
)
{
var
word
=
options
&&
options
.
word
||
WORD
;
var
range
=
options
&&
options
.
range
||
RANGE
;
...
...
@@ -447,7 +443,36 @@ var mac = /Mac/.test(navigator.platform);
var
curWord
=
start
!=
end
&&
curLine
.
slice
(
start
,
end
+
1
);
if
(
curWord
.
length
>
0
){
var
list
=
[],
seen
=
{};
var
includes
=
new
RegExp
(
INCLUIR
.
source
,
"
g
"
);
var
content
=
editor
.
getValue
();
var
list
=
[];
var
file
;
while
(
file
=
includes
.
exec
(
content
))
{
var
files
=
editor
.
state
.
completionActive
.
archivos
.
filter
(
function
(
a
){
return
a
.
nombre
===
file
[
1
];
});
for
(
var
f
=
0
;
f
<
files
.
length
;
f
++
){
var
seen
=
{};
var
re_digits
=
new
RegExp
(
/^
\d
+$/
,
"
g
"
);
var
re_funs
=
new
RegExp
(
COMPLETE_FUNS
.
source
,
"
g
"
);
var
m
;
var
file_content
=
files
[
f
].
contenido
;
while
(
m
=
re_funs
.
exec
(
file_content
))
{
if
(
!
re_digits
.
exec
(
m
[
1
])
&&
(
!
curWord
||
m
[
1
]
==
curWord
)
&&
!
Object
.
prototype
.
hasOwnProperty
.
call
(
seen
,
m
[
1
]))
{
seen
[
m
[
1
]]
=
true
;
list
.
push
(
files
[
f
].
nombre
+
"
.
"
+
m
[
1
]
+
m
[
2
]);
}
}
}
}
// current file
var
seen
=
{};
var
re_digits
=
new
RegExp
(
/^
\d
+$/
,
"
g
"
);
var
re_funs
=
new
RegExp
(
COMPLETE_FUNS
.
source
,
"
g
"
);
...
...
@@ -458,7 +483,7 @@ var mac = /Mac/.test(navigator.platform);
while
(
m
=
re_funs
.
exec
(
text
))
{
if
(
!
re_digits
.
exec
(
m
[
1
])
&&
(
!
curWord
||
m
[
1
]
==
curWord
)
&&
!
Object
.
prototype
.
hasOwnProperty
.
call
(
seen
,
m
[
1
]))
{
seen
[
m
[
1
]]
=
true
;
list
.
push
(
m
[
1
]
+
m
[
2
]);
list
.
push
(
editor
.
state
.
completionActive
.
filename
+
"
.
"
+
m
[
1
]
+
m
[
2
]);
}
}
}
...
...
Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_ES.js
View file @
3ff23a41
...
...
@@ -26,8 +26,9 @@ var mac = /Mac/.test(navigator.platform);
return
out
;
}
function
Completion
(
cm
,
options
,
filename
)
{
function
Completion
(
cm
,
options
,
filename
,
archivos
)
{
this
.
filename
=
filename
;
this
.
archivos
=
archivos
;
this
.
cm
=
cm
;
this
.
options
=
options
;
this
.
widget
=
null
;
...
...
@@ -196,7 +197,7 @@ var mac = /Mac/.test(navigator.platform);
var
rexp_name
=
new
RegExp
(
/
(
.*
\:\:)(
.*
)
/
.
source
,
"
g
"
);
var
m
=
rexp_name
.
exec
(
cur
.
displayText
||
getText
(
cur
));
var
b_elem
=
ownerDocument
.
createElement
(
"
b
"
);
b_elem
.
appendChild
(
ownerDocument
.
createTextNode
(
(
hintWords
.
ES_typed_functions
().
indexOf
(
m
[
1
]
+
m
[
2
])
==
-
1
?
(
completion
.
filename
+
'
.
'
)
:
""
)
+
m
[
1
]));
b_elem
.
appendChild
(
ownerDocument
.
createTextNode
(
m
[
1
]));
elt
.
appendChild
(
b_elem
);
elt
.
appendChild
(
ownerDocument
.
createTextNode
(
m
[
2
]));
}
...
...
@@ -411,22 +412,15 @@ var mac = /Mac/.test(navigator.platform);
var
WORD
=
/
[\w
$
]
+/
;
var
RANGE
=
500
;
var
SET
=
/set
\s
+
([\w\_\d]
+
)\s
*
\=
/
;
var
DOM
=
/
\:\:
/
;
var
FUNS
=
/
([\w\_\d]
+
)\s
+
\:\:
/
;
var
COMPLETE_FUNS
=
/
([\w\_\d\-]
+
)(\s
+
\:\:
.*
)
/
;
var
FUN
=
/
([\w\_\d]
+
)\s
*
\(([\,\w\_\s\d]
*
)\)\s
*
\=
/
;
var
ENUMS
=
/set
\s
+
[\w\_\d]
+
\s
*
\=\s
*
\{(
.*
?)\}
/
;
var
WRITING_SET
=
/set
\s
/
;
var
WRITING_COMMENT
=
/
\{\-
/
;
// functions definitions
CodeMirror
.
defineExtension
(
"
functionDefinition
"
,
function
(
filename
,
options
)
{
CodeMirror
.
defineExtension
(
"
functionDefinition
"
,
function
(
filename
,
archivos
,
options
)
{
if
(
options
.
mode
.
name
==
"
matefun-ES
"
){
options
=
parseOptions
(
this
,
this
.
getCursor
(
"
start
"
),
options
);
if
(
this
.
state
.
completionActive
)
this
.
state
.
completionActive
.
close
();
var
completion
=
this
.
state
.
completionActive
=
new
Completion
(
this
,
options
,
filename
);
var
completion
=
this
.
state
.
completionActive
=
new
Completion
(
this
,
options
,
filename
,
archivos
);
CodeMirror
.
signal
(
this
,
"
startFunctionDefinition
"
,
this
);
completion
.
update
(
true
);
...
...
@@ -437,6 +431,8 @@ var mac = /Mac/.test(navigator.platform);
if
(
this
.
state
.
completionActive
)
this
.
state
.
completionActive
.
close
()
})
var
INCLUIR
=
/incluir
\s
+
([\w\_\d]
+
)
/
;
function
functionDefinition
(
editor
,
options
)
{
var
word
=
options
&&
options
.
word
||
WORD
;
var
range
=
options
&&
options
.
range
||
RANGE
;
...
...
@@ -447,7 +443,36 @@ var mac = /Mac/.test(navigator.platform);
var
curWord
=
start
!=
end
&&
curLine
.
slice
(
start
,
end
+
1
);
if
(
curWord
.
length
>
0
){
var
list
=
[],
seen
=
{};
var
includes
=
new
RegExp
(
INCLUIR
.
source
,
"
g
"
);
var
content
=
editor
.
getValue
();
var
list
=
[];
var
file
;
while
(
file
=
includes
.
exec
(
content
))
{
var
files
=
editor
.
state
.
completionActive
.
archivos
.
filter
(
function
(
a
){
return
a
.
nombre
===
file
[
1
];
});
for
(
var
f
=
0
;
f
<
files
.
length
;
f
++
){
var
seen
=
{};
var
re_digits
=
new
RegExp
(
/^
\d
+$/
,
"
g
"
);
var
re_funs
=
new
RegExp
(
COMPLETE_FUNS
.
source
,
"
g
"
);
var
m
;
var
file_content
=
files
[
f
].
contenido
;
while
(
m
=
re_funs
.
exec
(
file_content
))
{
if
(
!
re_digits
.
exec
(
m
[
1
])
&&
(
!
curWord
||
m
[
1
]
==
curWord
)
&&
!
Object
.
prototype
.
hasOwnProperty
.
call
(
seen
,
m
[
1
]))
{
seen
[
m
[
1
]]
=
true
;
list
.
push
(
files
[
f
].
nombre
+
"
.
"
+
m
[
1
]
+
m
[
2
]);
}
}
}
}
// current file
var
seen
=
{};
var
re_digits
=
new
RegExp
(
/^
\d
+$/
,
"
g
"
);
var
re_funs
=
new
RegExp
(
COMPLETE_FUNS
.
source
,
"
g
"
);
...
...
@@ -458,7 +483,7 @@ var mac = /Mac/.test(navigator.platform);
while
(
m
=
re_funs
.
exec
(
text
))
{
if
(
!
re_digits
.
exec
(
m
[
1
])
&&
(
!
curWord
||
m
[
1
]
==
curWord
)
&&
!
Object
.
prototype
.
hasOwnProperty
.
call
(
seen
,
m
[
1
]))
{
seen
[
m
[
1
]]
=
true
;
list
.
push
(
m
[
1
]
+
m
[
2
]);
list
.
push
(
editor
.
state
.
completionActive
.
filename
+
"
.
"
+
m
[
1
]
+
m
[
2
]);
}
}
}
...
...
Frontend Angular 4/src/app/layout/matefun/matefun.component.ts
View file @
3ff23a41
...
...
@@ -460,7 +460,7 @@ export class MateFunComponent {
clickEnEditor
(
event
){
if
(
this
.
typingCheck
)
this
.
codemirror
.
instance
.
functionDefinition
(
this
.
archivo
.
nombre
,
this
.
codemirror
.
instance
.
doc
,
event
);
this
.
codemirror
.
instance
.
functionDefinition
(
this
.
archivo
.
nombre
,
this
.
archivosTree
.
archivos
,
this
.
codemirror
.
instance
.
doc
,
event
);
}
guardarArchivo
(){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment