# Compilatore
CC=gcc
CFLAGS=-W -g -Wall $(OPTLEVEL)
BINFOLDER=./bin
SRCFOLDER=./src
OBJFOLDER=./obj
all: test
test: $(OBJFOLDER)/tas-data.o $(OBJFOLDER)/tas-fct.o $(OBJFOLDER)/tas-io.o $(OBJFOLDER)/tas-main.o
$(CC) -o $(BINFOLDER)/tas-main $(OBJFOLDER)/tas-data.o $(OBJFOLDER)/tas-fct.o $(OBJFOLDER)/tas-io.o $(OBJFOLDER)/tas-main.o
$(OBJFOLDER)/tas-main.o: $(SRCFOLDER)/tas-main.c $(SRCFOLDER)/tas-io.h $(SRCFOLDER)/tas-fct.h $(SRCFOLDER)/tas-data.h
$(CC) -o $(OBJFOLDER)/tas-main.o -c $(SRCFOLDER)/tas-main.c
$(OBJFOLDER)/tas-data.o: $(SRCFOLDER)/tas-data.c $(SRCFOLDER)/tas-data.h
$(CC) -o $(OBJFOLDER)/tas-data.o -c $(SRCFOLDER)/tas-data.c
$(OBJFOLDER)/tas-fct.o: $(SRCFOLDER)/tas-fct.c $(SRCFOLDER)/tas-fct.h $(SRCFOLDER)/tas-data.h
$(CC) -o $(OBJFOLDER)/tas-fct.o -c $(SRCFOLDER)/tas-fct.c
$(OBJFOLDER)/tas-io.o: $(SRCFOLDER)/tas-io.c $(SRCFOLDER)/tas-io.h $(SRCFOLDER)/tas-data.h
$(CC) -o $(OBJFOLDER)/tas-io.o -c $(SRCFOLDER)/tas-io.c
clean:
rm -f $(BINFOLDER)/tas-main $(OBJFOLDER)/*.o
cleanall: clean
rm -rf $(BINFOLDER)/*
如上例所示,我想找到单词“ struct xx ”& “ fn xxx ”但只有“ fn xxx ”,结构范围内不在它之外[“ fn brung xxx ”],我使用这个正则表达式找到它
struct mbuh
(
lineshg = 0,
tres = "text",
fn track all:#() =
(
local c -- clone
local lpoint = [0,0,0] -- previous point created
local ccoll = #() -- array for created objects
local prev = [0,0] -- var for alt distance changing
),
fn listzfun trs:123 x:#() =
(
obj = snapshotasmesh a
min_vz = max_vz = in coordsys world (getvert obj 1).z
min_vx = max_vx = in coordsys world (getvert obj 1).x
min_vy = max_vy = in coordsys world (getvert obj 1).y
)
)
fn brung man: =
(
)
但它搜索结构范围内外的所有 fn 字,所以问题是如何才能找到只有在上面示例中的struct范围内的单词 fn xxx [ fn跟踪xxx和fn listzfun xxx ]?
非常感谢。
答案 0 :(得分:0)
你可以试试这个正则表达式:
(struct\s*\w+.*?(?=fn))(fn.*?(?=\),)\)).*?(?=fn)(fn.*?\))(?=\R\))
答案 1 :(得分:0)
我得到了与MYGz相同的等式,但它在c#
中@"\bstruct\s*\w+\s
\(
(?>
[^()]+
|
\((?<Depth>)
|
\)(?<-Depth>)
)*
(?(Depth)(?!))
\)
"
希望将来帮助别人。