📄 highlight.cpp
字号:
// -*- Mode : c++ -*-//// SUMMARY : // USAGE : // ORG : // AUTHOR : Antoine Le Hyaric -// E-MAIL : lehyaric@ann.jussieu.fr///* This file is part of Freefem++ Freefem++ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Freefem++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Freefem++; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */// Color-coding for FreeFem++-cs editor window// Antoine Le Hyaric - LJLL Paris - lehyaric@ann.jussieu.fr// $Id: highlight.cpp,v 1.19 2006-09-29 20:30:15 hecht Exp $#include <iostream>#include <cassert>using namespace std;#include "highlight.hpp"#include "hl_lexyacc.hpp"// Final result: a string containing highlight codesstring highlight;// Read from a string rather than from a filestring lexinput;int lexinputpos=0;// Remember which names have been properly definedmap<string,reservedinfo> reserved;map<string,string> symbols;vector<string> words;void inithighlightparser(){ reserved["append"]=reservedinfo(highlight_parameter,APPEND); reserved["R3"]=reservedinfo(highlight_type,R3); reserved["BFGS"]=reservedinfo(highlight_keyword,BFGS); reserved["BoundaryProblem"]=reservedinfo(highlight_keyword,BOUNDARYPROBLEM); reserved["CG"]=reservedinfo(highlight_keyword,CG); reserved["Cholesky"]=reservedinfo(highlight_keyword,CHOLESKY); reserved["Crout"]=reservedinfo(highlight_keyword,CROUT); reserved["GMRES"]=reservedinfo(highlight_keyword,GMRES); reserved["HaveUMFPACK"]=reservedinfo(highlight_keyword,HAVEUMFPACK); reserved["IsMetric"]=reservedinfo(highlight_parameter,ISMETRIC); reserved["hsv"]=reservedinfo(highlight_parameter,HSV); reserved["LU"]=reservedinfo(highlight_keyword,LU); reserved["LinearCG"]=reservedinfo(highlight_keyword,LINEARCG); reserved["EigenValue"]=reservedinfo(highlight_keyword,EIGENVALUE); reserved["LinearGMRES"]=reservedinfo(highlight_keyword,LINEARGMRES); reserved["nv"]=reservedinfo(highlight_global,BIG_N); reserved["nt"]=reservedinfo(highlight_global,BIG_N); reserved["N"]=reservedinfo(highlight_global,BIG_N); reserved["NLCG"]=reservedinfo(highlight_keyword,NLCG); reserved["Newton"]=reservedinfo(highlight_global,NEWTON); reserved["NoUseOfWait"]=reservedinfo(highlight_global,NOUSEOFWAIT); reserved["P"]=reservedinfo(highlight_global,P); reserved["P0"]=reservedinfo(highlight_type,P0); reserved["P0edge"]=reservedinfo(highlight_type,P0edge); reserved["P1"]=reservedinfo(highlight_type,P1); reserved["P1b"]=reservedinfo(highlight_type,P1B); reserved["P1dc"]=reservedinfo(highlight_type,P1DC); reserved["P1nc"]=reservedinfo(highlight_type,P1NC); reserved["P2"]=reservedinfo(highlight_type,P2); reserved["P2b"]=reservedinfo(highlight_type,P2B); reserved["P2dc"]=reservedinfo(highlight_type,P2DC); reserved["P2h"]=reservedinfo(highlight_type,P2H); reserved["RT0"]=reservedinfo(highlight_type,RT0); reserved["RT0Ortho"]=reservedinfo(highlight_type,RT0ORTHO); reserved["UMFPACK"]=reservedinfo(highlight_keyword,UMFPACK); reserved["abs"]=reservedinfo(highlight_keyword,ABS); reserved["abserror"]=reservedinfo(highlight_parameter,ABSERROR); reserved["acos"]=reservedinfo(highlight_keyword,ACOS); reserved["acosh"]=reservedinfo(highlight_keyword,ACOSH); reserved["adaptmesh"]=reservedinfo(highlight_keyword,ADAPTMESH); reserved["anisomax"]=reservedinfo(highlight_parameter,ANISOMAX); reserved["area"]=reservedinfo(highlight_global,AREA); reserved["arg"]=reservedinfo(highlight_keyword,ARG); reserved["asin"]=reservedinfo(highlight_keyword,ASIN); reserved["asinh"]=reservedinfo(highlight_keyword,ASINH); reserved["aspectratio"]=reservedinfo(highlight_parameter,ASPECTRATIO); reserved["assert"]=reservedinfo(highlight_keyword,ASSERT); reserved["atan"]=reservedinfo(highlight_keyword,ATAN); reserved["atan2"]=reservedinfo(highlight_keyword,ATAN2); reserved["atanh"]=reservedinfo(highlight_keyword,ATANH); reserved["average"]=reservedinfo(highlight_keyword,AVERAGE); reserved["bb"]=reservedinfo(highlight_parameter,BB); reserved["binside"]=reservedinfo(highlight_parameter,BINSIDE); reserved["bmat"]=reservedinfo(highlight_parameter,BMAT); reserved["bool"]=reservedinfo(highlight_type,BOOL); reserved["border"]=reservedinfo(highlight_type,BORDER); reserved["break"]=reservedinfo(highlight_keyword,BREAK); reserved["broadcast"]=reservedinfo(highlight_keyword,BROADCAST); reserved["buildmesh"]=reservedinfo(highlight_keyword,BUILDMESH); reserved["buildmeshborder"]=reservedinfo(highlight_keyword,BUILDMESHBORDER); reserved["bw"]=reservedinfo(highlight_parameter,BW); reserved["cadna"]=reservedinfo(highlight_parameter,CADNA); reserved["checkmovemesh"]=reservedinfo(highlight_keyword,CHECKMOVEMESH); reserved["cin"]=reservedinfo(highlight_global,CIN); reserved["clean"]=reservedinfo(highlight_parameter,CLEAN); reserved["clock"]=reservedinfo(highlight_keyword,CLOCK); reserved["cmm"]=reservedinfo(highlight_parameter,CMM); reserved["coef"]=reservedinfo(highlight_parameter,COEF); reserved["complex"]=reservedinfo(highlight_type,COMPLEX); reserved["conj"]=reservedinfo(highlight_keyword,CONJ); reserved["continue"]=reservedinfo(highlight_keyword,CONTINUE); reserved["convect"]=reservedinfo(highlight_keyword,CONVECT); reserved["cos"]=reservedinfo(highlight_keyword,COS); reserved["cosh"]=reservedinfo(highlight_keyword,COSH); reserved["cout"]=reservedinfo(highlight_global,COUT); reserved["cutoff"]=reservedinfo(highlight_parameter,CUTOFF); reserved["diag"]=reservedinfo(highlight_global,DIAG); reserved["dimKrylov"]=reservedinfo(highlight_parameter,DIMKRYLOV); reserved["dumptable"]=reservedinfo(highlight_keyword,DUMPTABLE); reserved["dn"]=reservedinfo(highlight_keyword,DN); reserved["dx"]=reservedinfo(highlight_keyword,DX); reserved["dxx"]=reservedinfo(highlight_keyword,DXX); reserved["dxy"]=reservedinfo(highlight_keyword,DXY); reserved["dy"]=reservedinfo(highlight_keyword,DY); reserved["dyx"]=reservedinfo(highlight_keyword,DYX); reserved["dyy"]=reservedinfo(highlight_keyword,DYY); reserved["dz"]=reservedinfo(highlight_keyword,DZ); reserved["else"]=reservedinfo(highlight_keyword,ELSE); reserved["emptymesh"]=reservedinfo(highlight_keyword,EMPTYMESH); reserved["end"]=reservedinfo(highlight_keyword,END); reserved["endl"]=reservedinfo(highlight_global,ENDL); reserved["eps"]=reservedinfo(highlight_parameter,EPS); reserved["err"]=reservedinfo(highlight_parameter,ERR); reserved["errg"]=reservedinfo(highlight_parameter,ERRG); reserved["exec"]=reservedinfo(highlight_keyword,EXEC); reserved["exit"]=reservedinfo(highlight_keyword,EXIT); reserved["exp"]=reservedinfo(highlight_keyword,EXP); reserved["factorize"]=reservedinfo(highlight_parameter,FACTORIZE); reserved["false"]=reservedinfo(highlight_global,FF_FALSE); reserved["fespace"]=reservedinfo(highlight_type,FESPACE); reserved["fill"]=reservedinfo(highlight_parameter,FILL); reserved["for"]=reservedinfo(highlight_keyword,FOR); reserved["func"]=reservedinfo(highlight_type,FUNC); reserved["grey"]=reservedinfo(highlight_parameter,GREY); reserved["hTriangle"]=reservedinfo(highlight_global,HTRIANGLE); reserved["hmax"]=reservedinfo(highlight_parameter,HMAX); reserved["hmin"]=reservedinfo(highlight_parameter,HMIN); reserved["i"]=reservedinfo(highlight_global,I); reserved["if"]=reservedinfo(highlight_keyword,IF); reserved["ifstream"]=reservedinfo(highlight_type,IFSTREAM); reserved["imag"]=reservedinfo(highlight_type,IMAG); reserved["include"]=reservedinfo(highlight_keyword,INCLUDE); reserved["init"]=reservedinfo(highlight_parameter,INIT); reserved["inquire"]=reservedinfo(highlight_parameter,INQUIRE); reserved["inside"]=reservedinfo(highlight_parameter,INSIDE); reserved["int"]=reservedinfo(highlight_type,INT); reserved["int1d"]=reservedinfo(highlight_keyword,INT1D); reserved["int2d"]=reservedinfo(highlight_keyword,INT2D); reserved["intalledges"]=reservedinfo(highlight_keyword,INTALLEDGES); reserved["interpolate"]=reservedinfo(highlight_keyword,INTERPOLATE); reserved["iso"]=reservedinfo(highlight_parameter,ISO); reserved["ivalue"]=reservedinfo(highlight_parameter,IVALUE); reserved["jump"]=reservedinfo(highlight_keyword,JUMP); reserved["keepbackvertices"]=reservedinfo(highlight_parameter,KEEPBACKVERTICES); reserved["label"]=reservedinfo(highlight_global,LABEL); reserved["lenEdge"]=reservedinfo(highlight_global,LENEDGE); reserved["load"]=reservedinfo(highlight_keyword,LOAD); reserved["log"]=reservedinfo(highlight_keyword,LOG); reserved["log10"]=reservedinfo(highlight_keyword,LOG10); reserved["m"]=reservedinfo(highlight_global,M); reserved["matrix"]=reservedinfo(highlight_type,MATRIX); reserved["resize"]=reservedinfo(highlight_global,RESIZE); reserved["max"]=reservedinfo(highlight_global,MAX); reserved["maxit"]=reservedinfo(highlight_parameter,MAXIT); reserved["maxsubdiv"]=reservedinfo(highlight_parameter,MAXSUBDIV); reserved["mean"]=reservedinfo(highlight_keyword,MEAN); reserved["mesh"]=reservedinfo(highlight_type,MESH); reserved["metric"]=reservedinfo(highlight_parameter,METRIC); reserved["min"]=reservedinfo(highlight_global,MIN); reserved["movemesh"]=reservedinfo(highlight_keyword,MOVEMESH); reserved["mpirank"]=reservedinfo(highlight_keyword,MPIRANK); reserved["mpisize"]=reservedinfo(highlight_keyword,MPISIZE); reserved["n"]=reservedinfo(highlight_global,SMALL_N); reserved["nTonEdge"]=reservedinfo(highlight_global,NTONEDGE); reserved["nbarrow"]=reservedinfo(highlight_parameter,NBARROW); reserved["nbev"]=reservedinfo(highlight_parameter,NBEV); reserved["nbiso"]=reservedinfo(highlight_parameter,NBISO); reserved["nbiter"]=reservedinfo(highlight_parameter,NBITER); reserved["nbiterline"]=reservedinfo(highlight_parameter,NBITERLINE); reserved["nbjacoby"]=reservedinfo(highlight_parameter,NBJACOBY); reserved["nbsmooth"]=reservedinfo(highlight_parameter,NBSMOOTH); reserved["nbvx"]=reservedinfo(highlight_parameter,NBVX); reserved["ncv"]=reservedinfo(highlight_parameter,NCV); reserved["nomeshgeneration"]=reservedinfo(highlight_parameter,NOMESHGENERATION); reserved["norm"]=reservedinfo(highlight_keyword,NORM); reserved["nuEdge"]=reservedinfo(highlight_global,NUEDGE); reserved["precision"]=reservedinfo(highlight_global,PRECISION); reserved["sum"]=reservedinfo(highlight_global,SUM); reserved["ndof"]=reservedinfo(highlight_global,NDOF); reserved["ndofK"]=reservedinfo(highlight_global,NDOFK); reserved["nuTriangle"]=reservedinfo(highlight_global,NUTRIANGLE); reserved["ofstream"]=reservedinfo(highlight_type,OFSTREAM); reserved["omega"]=reservedinfo(highlight_parameter,OMEGA); reserved["on"]=reservedinfo(highlight_keyword,ON);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -