summaryrefslogtreecommitdiff
path: root/src/mt/skip_parentesis.f
diff options
context:
space:
mode:
Diffstat (limited to 'src/mt/skip_parentesis.f')
-rw-r--r--src/mt/skip_parentesis.f42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mt/skip_parentesis.f b/src/mt/skip_parentesis.f
new file mode 100644
index 0000000..1104c8f
--- /dev/null
+++ b/src/mt/skip_parentesis.f
@@ -0,0 +1,42 @@
1ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2c
3c HTCd - Copyright (C) 1998-2006 Henrik Rydberg
4c
5c This program is free software; you can redistribute it and/or modify
6c it under the terms of the GNU General Public License as published by
7c the Free Software Foundation; either version 2 of the License, or
8c (at your option) any later version.
9c
10c This program is distributed in the hope that it will be useful,
11c but WITHOUT ANY WARRANTY; without even the implied warranty of
12c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13c GNU General Public License for more details.
14c
15c You should have received a copy of the GNU General Public License
16c along with this program; if not, write to the Free Software
17c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18c
19
20 integer function skip_parentesis(s,n,left,right,esc)
21 character s(0:1),left,right,esc
22 integer i,n,cnt
23 if(n.eq.0)go to 40
24 if(s(0).ne.left)go to 40
25 cnt=1
26 do 10 i=1,n-1
27 if(s(i-1).eq.esc)go to 10
28 if(s(i).eq.right)then
29 cnt=cnt-1
30 if(cnt.eq.0)go to 30
31 else if(s(i).eq.left)then
32 cnt=cnt+1
33 end if
34 10 continue
35 20 skip_parentesis=-1
36 return
37 30 skip_parentesis=i+1
38 return
39 40 skip_parentesis=0
40 return
41 end
42