Special characters/symbols

1. Frequently used

  . full stop 句号

  , comma 逗号

  : colon 冒号

  ; semicolon 分号

  ? question mark 问号

  ! exclamation mark (英式英语) exclamation point (美式英语)

  ' apostrophe 撇号

  - hyphen 连字号

  -- dash 破折号

  ... dots/ ellipsis 省略号

  { open brace, open curly 左花括号

  } close brace, close curly 右花括号

  ( open parenthesis, open paren 左圆括号

  ) close parenthesis, close paren 右圆括号

  () brakets/ parentheses 括号

  [ open bracket 左方括号

  ] close bracket 右方括号

  [] square brackets 方括号

  . period, dot 句号,点

  | vertical bar, vertical virgule 竖线

  & ampersand, and, reference, ref 和,引用

  * asterisk, multiply, star, pointer 星号,乘号,星,指针

  / slash, divide, oblique 斜线,斜杠,除号

  \ backslash 反斜杠

  // slash-slash, comment 双斜线,注释符

  # pound 井号

  escape 反斜线转义符,有时表示转义符或续行符

  ~ tilde 波浪符

  " single quotation marks 单引号

  "" double quotation marks 双引号

  ‖ parallel 双线号

  & ampersand = and

  ~ swung dash 代字号

  § section; division 分节号

  → arrow 箭号;参见号

       +  plus 加号;正号

   minus 减号;负号

  ± plus or minus 正负号

  × is multiplied by 乘号

  ÷ is divided by 除号

  = is equal to 等于号

  ≠ is not equal to 不等于号

  ≡ is equivalent to 全等于号

  ≌ is equal to or approximately equal to 等于或约等于号

  ≈ is approximately equal to 约等于号

  < is less than 小于号

  > is more than 大于号

  ≮ is not less than 不小于号

  ≯ is not more than 不大于号

  ≤ is less than or equal to 小于或等于号

  ≥ is more than or equal to 大于或等于号

   per cent 百分之...

  ‰ per mill 千分之...

2. Less Frequently used

  √ (square) root 平方根

  ° degree

  ′ minute

  ″ second

  ℃ Celsius system 摄氏度

  ∵ since; because 因为

  ∴ hence 所以

  ∷ equals, as (proportion) 等于,成比例

  ∠ angle

  ⌒ semicircle 半圆

  ⊙ circle

  ○ circumference 圆周

  π pi 圆周率

  △ triangle 三角形

  ⊥ perpendicular to 垂直于

  ∪ union of 并,合集

  ∩ intersection of 交,通集

  ∫ the integral of ...的积分

  ∑ (sigma) summation of 总和

  ∞ infinity 无限大号

  ∝ varies as ...成比例

有个网站好像是用来查看权限配置的,To find where setResourceMonitors is defined: defs:setResourceMonitors To find files that use sprintf in usr/src/cmd/cmd-inet/usr.sbin/: refs:sprintf path:usr/src/cmd/cmd-inet/usr.sbin To find assignments to variable foo: "foo =" To find Makefiles where the pstack binary is being built: pstack path:Makefile to search for phrase "Bill Joy": "Bill Joy" To find perl files that do not use /usr/bin/perl but something else: -"/usr/bin/perl" +"/bin/perl" To find all strings beginning with foo use the wildcard: foo* To find all files which have . c in their name (dot is a token!): ". c" To find all files which start with "ma" and then have only alphabet characters do: path:/ma[a-zA-Z]*/ To find all main methods in all files analyzed by C analyzer (so .c, .h, ...) do: main type:c More info: A Query is a series of clauses. A clause may be prefixed by: a plus "+" or a minus "-" sign, indicating that the clause is required or prohibited respectively; or a term followed by a colon ":", indicating the field to be searched. This enables one to construct queries which search multiple fields. A clause may be either: a term, indicating all the documents that contain this term; or a phrase - group of words surrounded by double quotes " ", e.g. "hello dolly" a nested query, enclosed in parentheses "(" ")" (also called query/field grouping) . Note that this may be used with a +/- prefix to require any of a set of terms. boolean operators which allow terms to be combined through logic operators. Supported are AND(&&), "+", OR(||), NOT(!) and "-" (Note: they must be ALL CAPS). Regular Expression, Wildcard, Fuzzy, Proximity and Range Searches: to perform a regular expression search use the "/" enclosure, e.g. /[mb]an/ - will search for man or for ban; NOTE: path field search escapes "/" by default, so it only supports regexps when the search string starts and ends with "/". More info can be found on Lucene regexp page. to perform a single character wildcard search use the "?" symbol, e.g. te?t to perform a multiple character wildcard search use the "*" symbol, e.g. test* or te*t you can use a * or ? symbol as the first character of a search (unless not enabled using indexer option -a). to do a fuzzy search (find words similar in spelling, based on the Levenshtein Distance, or Edit Distance algorithm) use the tilde, "~", e.g. rcs~ to do a proximity search use the tilde, "~", symbol at the end of a Phrase. For example to search for a "opengrok" and "help" within 10 words of each other enter: "opengrok help"~10 range queries allow one to match documents whose field(s) values are between the lower and upper bound specified by the Range Query. Range Queries can be inclusive or exclusive of the upper and lower bounds. Sorting is done lexicographically. Inclusive queries are denoted by square brackets [ ] , exclusive by curly brackets { }. For example: title:{Aida TO Carmen} - will find all documents between Aida to Carmen, exclusive of Aida and Carmen. Escaping special characters: Opengrok supports escaping special characters that are part of the query syntax. Current special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / To escape these character use the \ before the character. For example to search for (1+1):2 use the query: \(1\+1\)\:2 NOTE on analyzers: Indexed words are made up of Alpha-Numeric and Underscore characters. One letter words are usually not indexed as symbols! Most other characters (including single and double quotes) are treated as "spaces/whitespace" (so even if you escape them, they will not be found, since most analyzers ignore them). The exceptions are: @ $ % ^ & = ? . : which are mostly indexed as separate words. Because some of them are part of the query syntax, they must be escaped with a reverse slash as noted above. So searching for \+1 or \+ 1 will both find +1 and + 1. Valid FIELDs are full Search through all text tokens (words,strings,identifiers,numbers) in index. defs Only finds symbol definitions (where e.g. a variable (function, ...) is defined). refs Only finds symbols (e.g. methods, classes, functions, variables). path path of the source file (no need to use dividers, or if, then use "/" - Windows users, "\" is an escape key in Lucene query syntax! Please don't use "\", or replace it with "/"). Also note that if you want just exact path, enclose it in "", e.g. "src/mypath", otherwise dividers will be removed and you get more hits. type Type of analyzer used to scope down to certain file types (e.g. just C sources). Current mappings: [ada=Ada, asm=Asm, bzip2=Bzip(2), c=C, clojure=Clojure, csharp=C#, cxx=C++, eiffel=Eiffel, elf=ELF, erlang=Erlang, file=Image file, fortran=Fortran, golang=Golang, gzip=GZIP, haskell=Haskell, hcl=HCL, jar=Jar, java=Java, javaclass=Java class, javascript=JavaScript, json=Json, kotlin=Kotlin, lisp=Lisp, lua=Lua, mandoc=Manual pages, pascal=Pascal, perl=Perl, php=PHP, plain=Plain Text, plsql=PL/SQL, powershell=PowerShell script, python=Python, r=R, ruby=Ruby, rust=Rust, scala=Scala, sh=Shell script, sql=SQL, swift=Swift, tar=Tar, tcl=Tcl, terraform=Terraform, troff=Troff, typescript=TypeScript, uuencode=UUEncoded, vb=Visual Basic, verilog=Verilog, xml=XML, yaml=Yaml, zip=Zip] The term (phrases) can be boosted (making it more relevant) using a caret ^ , e.g. help^4 opengrok - will make term help boosted Opengrok search is powered by Lucene, for more detail on query syntax refer to Lucene docs. Intelligence Window这是用例,我该怎么来查找这个权限
11-14
[71]"D:/Work/CCS/ccs_20/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmclang.exe" -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -mthumb -gdwarf-3 -march=armv7e-m -Wl,-m"simple_tx_rfprop.map" -Wl,-i"D:/Work/SatIoT/CC1352/SDK/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/source" -Wl,-i"D:/Work/SatIoT/CC1352/SDK/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/kernel/tirtos7/packages" -Wl,-i"D:/Work/Project/jiang/bload-master/simple_tx_rfprop/Debug/syscfg" -Wl,-i"D:/Work/CCS/ccs_20/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/lib" -Wl,--diag_wrap=off -Wl,--display_error_number -Wl,--warn_sections -Wl,--xml_link_info="simple_tx_rfprop_linkInfo.xml" -Wl,--rom_model -o "simple_tx_rfprop.out" "./main_tirtos.o" "./rfPacketTx.o" "./syscfg/ti_devices_config.o" "./syscfg/ti_radio_config.o" "./syscfg/ti_drivers_config.o" "./syscfg/ti_sysbios_config.o" "./oad/bim_interface.o" "./oad/flash_interface.o" "./oad/oad_image_header.o" "./oad/upgrade_manager.o" "../cc13x2_cc26x2_tirtos7_active.cmd" -Wl,-lti_utils_build_linker.cmd.genlibs -Wl,-llibc.a [72]gmake[1]: *** No rule to make target 'input-file.error', needed by 'output-file.error'. [73]Finished building target: "simple_tx_rfprop.out" [74]D:/Work/CCS/ccs_20/ccs/tools/compiler/ti-cgt-armllvm_4.0.3.LTS/bin/tiarmobjcopy -O ihex simple_tx_rfprop.out simple_tx_rfprop.hexD:/Work/SatIoT/CC1352/SDK/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/tools/common/oad/oad_image_tool --verbose ccs D:/Work/Project/jiang/bload-master/simple_tx_rfprop/Debug 7 -hex1 D:/Work/Project/jiang/bload-master/simple_tx_rfprop/Debug/simple_tx_rfprop.hex -k D:/Work/SatIoT/CC1352/SDK/simplelink_cc13xx_cc26xx_sdk_8_30_01_01/tools/common/oad/private.pem -o D:/Work/Project/jiang/bload-master/simple_tx_rfprop/Debug/simple_tx_rfprop_oad [75]OVERVIEW: llvm-objcopy tool [76]USAGE: llvm-objcopy [options] input [output] [77]OPTIONS: [78] --add-gnu-debuglink=debug-file [79] Add a .gnu_debuglink for <debug-file> [80] --add-note-segment=file Make a note segment with the contents of <file>. [81] --add-section=section=file [82] Make a section named <section> with the contents of <file> [83] --add-symbol=name=[section:]value[,flags] [84] Add new symbol <name> to .symtab. Accepted flags: global, local, weak, default, hidden, protected, file, section, object, function, indirect-function. Accepted but ignored for compatibility: debug, constructor, warning, indirect, synthetic, unique-object, before [85] --adjust-start <value> Alias for --change-start [86] --allow-broken-links Allow the tool to remove sections even if it would leave invalid section references. The appropriate sh_link fields will be set to zero. [87] --binary-architecture=<value> [88] Ignored for compatibility [89] -B <value> Alias for --binary-architecture [90] --change-start=incr Add <incr> to the start address. Can be specified multiple times, all values will be applied cumulatively [91] --compress-debug-sections=format [92] Compress DWARF debug sections using specified format. Supported formats: zlib, zstd. Select zlib if <format> is omitted [93] --core-exe=coreid:filename [94] Specify an ELF executable for a Core ID as input. [95] --decompress-debug-sections [96] Decompress DWARF debug sections [97] --disable-deterministic-archives [98] Disable deterministic mode when operating on archives (use real values for UIDs, GIDs, and timestamps). [99] --discard-all Remove all local symbols except file and section symbols. Also remove all debug sections [100] --discard-locals Remove compiler-generated local symbols, (e.g. symbols starting with .L) [101] --dump-mmELFConfig Dump the contents of the internal mmELFConfig structure. [102] --dump-section=section=file [103] Dump contents of section named <section> into file <file> [104] -D Alias for --enable-deterministic-archives [105] --enable-deterministic-archives [106] Enable deterministic mode when operating on archives (use zero for UIDs, GIDs, and timestamps). [107] --extract-dwo Remove all sections that are not DWARF .dwo sections from file [108] --extract-main-partition [109] Extract main partition from the input file [110] --extract-partition=name [111] Extract named partition from input file [112] -F <value> Alias for --target [113] --gap-fill=value Fill the gaps between sections with <value> instead of zero. <value> must be an unsigned 8-bit integer. This option is only supported for ELF input and binary output [114] --globalize-symbol=symbol [115] Mark <symbol> as global [116] --globalize-symbols=filename [117] Reads a list of symbols from <filename> and marks them global [118] -G <value> Alias for --keep-global-symbol [119] -g Alias for --strip-debug [120] --input-target=<value> Format of the input file [121] -I <value> Alias for --input-target [122] -j <value> Alias for --only-section [123] --keep-file-symbols Do not remove file symbols [124] --keep-global-symbol=symbol [125] Convert all symbols except <symbol> to local. May be repeated to convert all except a set of symbols to local [126] --keep-global-symbols=filename [127] Reads a list of symbols from <filename> and runs as if --keep-global-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files [128] --keep-section=section Keep <section> [129] --keep-symbol=symbol Do not remove symbol <symbol> [130] --keep-symbols=filename Reads a list of symbols from <filename> and runs as if --keep-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files [131] --keep-undefined Do not remove undefined symbols [132] -K <value> Alias for --keep-symbol [133] --localize-hidden Mark all symbols that have hidden or internal visibility as local [134] --localize-symbol=symbol [135] Mark <symbol> as local [136] --localize-symbols=filename [137] Reads a list of symbols from <filename> and marks them local [138] -L <value> Alias for --localize-symbol [139] --new-symbol-visibility=<value> [140] Visibility of symbols generated for binary input or added with --add-symbol unless otherwise specified. The default value is 'default' [141] -N <value> Alias for --strip-symbol [142] --only-keep-debug Produce a debug file as the output that only preserves contents of sections useful for debugging purposes [143] --only-section=section Remove all but <section> [144] --output-target=<value> Format of the output file [145] -O <value> Alias for --output-target [146] --pad-to=address Pad the output up to the load address <address>, using a value of zero or the value specified by the --gap-fill option. This option is only supported for ELF input and binary output [147] --prefix-alloc-sections=prefix [148] Add <prefix> to the start of every allocated section name [149] --prefix-symbols=prefix Add <prefix> to the start of every symbol name [150] --preserve-dates Preserve access and modification timestamps [151] -p Alias for --preserve-dates [152] --redefine-sym=old=new Change the name of a symbol old to new [153] --redefine-syms=filename [154] Reads a list of symbol pairs from <filename> and runs as if --redefine-sym=<old>=<new> is set for each one. <filename> contains two symbols per line separated with whitespace and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files [155] --regex Permit regular expressions in name comparison [156] --remove-section=section [157] Remove <section> [158] --rename-section=old=new[,flag1,...] [159] Renames a section from old to new, optionally with specified flags. Flags supported for GNU compatibility: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings, large [160] -R <value> Alias for --remove-section [161] --set-section-alignment=section=align [162] Set alignment for a given section [163] --set-section-flags=section=flag1[,flag2,...] [164] Set section flags for a given section. Flags supported for GNU compatibility: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings, large [165] --set-section-type=section=type [166] Set the type of section <section> to the integer <type> [167] --set-start=addr Set the start address to <addr>. Overrides any previous --change-start or --adjust-start values [168] --shared-obj=filename Specify a static shared object file as input for building an mmELF file. [169] --split-dwo=dwo-file Equivalent to extract-dwo on the input file to <dwo-file>, then strip-dwo on the input file [170] --strip-all-gnu Compatible with GNU's --strip-all [171] --strip-all Remove non-allocated sections outside segments. .gnu.warning* and .ARM.attribute sections are not removed [172] --strip-debug Remove all debug sections [173] --strip-dwo Remove all DWARF .dwo sections from file [174] --strip-non-alloc Remove all non-allocated sections outside segments [175] --strip-sections Remove all section headers and all sections not in segments [176] --strip-symbol=symbol Strip <symbol> [177] --strip-symbols=filename [178] Reads a list of symbols from <filename> and removes them [179] --strip-unneeded-symbol=symbol [180] Remove symbol <symbol> if it is not needed by relocations [181] --strip-unneeded-symbols=filename [182] Reads a list of symbols from <filename> and removes them if they are not needed by relocations [183] --strip-unneeded Remove all symbols not needed by relocations [184] --subsystem=name[:version] [185] Set PE subsystem and version [186] -S Alias for --strip-all [187] --target=<value> Format of the input and output file [188] --update-section=name=file [189] Replace the contents of section <name> with contents from a file <file> [190] -U Alias for --disable-deterministic-archives [191] --version Print the version and exit. [192] -V Alias for --version [193] --weaken-symbol=symbol Mark <symbol> as weak [194] --weaken-symbols=filename [195] Reads a list of symbols from <filename> and marks them weak [196] --weaken Mark all global symbols as weak [197] --wildcard Allow wildcard syntax for symbol-related flags. Incompatible with --regex. Allows using '*' to match any number of characters, '?' to match any single character, '' to escape special characters, and '[]' to define character classes. Wildcards beginning with '!' will prevent a match, for example "-N '*' -N '!x'" will strip all symbols except for "x". [198] -W <value> Alias for --weaken-symbol [199] -w Alias for --wildcard [200] -X Alias for --discard-locals [201] -x Alias for --discard-all [202]Pass @FILE as argument to read options from FILE. [203]gmake[1]: Target 'secondary-outputs' not remade because of errors. [204]gmake: *** [makefile:155: all] Error 2 报错
07-18
练习相关测试知识和技术,如单元测试、白盒测试等。 内容:给定一个有bug的Java源代码文件 Printtokens2.java(见下方附件,包含很多待测试的函数),要求为每个待测函数设计足够多且合理的单元测试用例(每个测试用例包括输入和预期输出),然后使用JUnit单元测试工具运行这些测试用例,从而触发源代码中的全部或大部分bug。 package JUnit4Printtokens2; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringReader; public class Printtokens2 { static int error = 0; static int keyword = 1; static int spec_symbol = 2; static int identifier = 3; static int num_constant = 41; static int str_constant = 42; static int char_constant = 43; static int comment = 5; /***********************************************/ /* NMAE: open_character_stream */ /* INPUT: a filename */ /* OUTPUT: a BufferedReader */ /* DESCRIPTION: when not given a filename, */ /* open stdin,otherwise open */ /* the existed file */ /***********************************************/ BufferedReader open_character_stream(String fname) { BufferedReader br = null; if (fname == null) { br = new BufferedReader(new InputStreamReader(System.in)); } else { try { FileReader fr = new FileReader(fname); br = new BufferedReader(fr); } catch (FileNotFoundException e) { System.out.print("The file " + fname +" doesn't exists\n"); e.printStackTrace(); } } return null; } /**********************************************/ /* NAME: get_char */ /* INPUT: a BufferedReader */ /* OUTPUT: a character */ /**********************************************/ int get_char(BufferedReader br){ int ch = 0; try { br.mark(3); ch= br.read(); } catch (IOException e) { e.printStackTrace(); } return ch; } /***************************************************/ /* NAME: unget_char */ /* INPUT: a BufferedReader,a character */ /* OUTPUT: a character */ /* DESCRIPTION: move backward */ /***************************************************/ char unget_char (int ch,BufferedReader br) { try { br.reset(); } catch (IOException e) { e.printStackTrace(); } return 0; } /********************************************************/ /* NAME: open_token_stream */ /* INPUT: a filename */ /* OUTPUT: a BufferedReader */ /* DESCRIPTION: when filename is EMPTY,choice standard */ /* input device as input source */ /********************************************************/ BufferedReader open_token_stream(String fname) { BufferedReader br; if(fname.equals(null)) br=open_character_stream(null); else br=open_character_stream(fname); return br; } /********************************************************/ /* NAME : get_token */ /* INPUT: a BufferedReader */ /* OUTPUT: a token string */ /* DESCRIPTION: according the syntax of tokens,dealing */ /* with different case and get one token */ /********************************************************/ String get_token(BufferedReader br) { int i=0,j; int id=0; int res = 0; char ch = '\0'; StringBuilder sb = new StringBuilder(); try { res = get_char(br); if (res == -1) { return null; } ch = (char)res; while(ch=='\t'||ch=='\n' || ch == '\r') /* strip all blanks until meet characters */ { res = get_char(br); ch = (char)res; } if(res == -1)return null; sb.append(ch); if(is_spec_symbol(ch)==true)return sb.toString(); if(ch =='"')id=2; /* prepare for string */ if(ch ==59)id=1; /* prepare for comment */ res = get_char(br); if (res == -1) { unget_char(ch,br); return sb.toString(); } ch = (char)res; while (is_token_end(id,res) == false)/* until meet the end character */ { sb.append(ch); br.mark(4); res = get_char(br); if (res == -1) { break; } ch = (char)res; } if(res == -1) /* if end character is eof token */ { unget_char(ch,br); /* then put back eof on token_stream */ return sb.toString(); } if(is_spec_symbol(ch)==true) /* if end character is special_symbol */ { unget_char(ch,br); /* then put back this character */ return sb.toString(); } if(id==1) /* if end character is " and is string */ { sb.append(ch); return sb.toString(); } if(id==0 && ch==59) /* when not in string or comment,meet ";" */ { unget_char(ch,br); /* then put back this character */ return sb.toString(); } } catch (IOException e) { e.printStackTrace(); } return sb.toString(); /* return nomal case token */ } /*******************************************************/ /* NAME: is_token_end */ /* INPUT: a character,a token status */ /* OUTPUT: a BOOLEAN value */ /*******************************************************/ static boolean is_token_end(int str_com_id, int res) { if(res==-1)return(true); /* is eof token? */ char ch = (char)res; if(str_com_id==1) /* is string token */ { if(ch=='"' | ch=='\n' || ch == '\r') /* for string until meet another " */ return true; else return false; } if(str_com_id==2) /* is comment token */ { if(ch=='\n' || ch == '\r' || ch=='\t') /* for comment until meet end of line */ return true; else return false; } if(is_spec_symbol(ch)==true) return true; /* is special_symbol? */ if(ch ==' ' || ch=='\n'|| ch=='\r' || ch==59) return true; return false; /* other case,return FALSE */ } /****************************************************/ /* NAME : token_type */ /* INPUT: a token */ /* OUTPUT: an integer value */ /* DESCRIPTION: the integer value is corresponding */ /* to the different token type */ /****************************************************/ static int token_type(String tok) { if(is_keyword(tok))return(keyword); if(is_spec_symbol(tok.charAt(0)))return(spec_symbol); if(is_identifier(tok))return(identifier); if(is_num_constant(tok))return(num_constant); if(is_str_constant(tok))return(str_constant); if(is_char_constant(tok))return(char_constant); if(is_comment(tok))return(comment); return(error); /* else look as error token */ } /****************************************************/ /* NAME: print_token */ /* INPUT: a token */ /****************************************************/ void print_token(String tok) { int type; type=token_type(tok); if(type==error) { System.out.print("error,\"" + tok + "\".\n"); } if(type==keyword) { System.out.print("keyword,\"" + tok + "\".\n"); } if(type==spec_symbol)print_spec_symbol(tok); if(type==identifier) { System.out.print("identifier,\"" + tok + "\".\n"); } if(type==num_constant) { System.out.print("numeric," + tok + ".\n"); } if(type==char_constant) { System.out.print("character,\"" + tok.charAt(1) + "\".\n"); } } /* the code for tokens judgment function */ /*************************************/ /* NAME: is_comment */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_comment(String ident) { if( ident.charAt(0) ==59 ) /* the char is 59 */ return true; else return false; } /*************************************/ /* NAME: is_keyword */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_keyword(String str) { if (str.equals("and") || str.equals("or") || str.equals("if") || str.equals("xor")||str.equals("lambda")||str.equals("=>")) return true; else return false; } /*************************************/ /* NAME: is_char_constant */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_char_constant(String str) { if (str.length() > 2 && str.charAt(0)=='#' && Character.isLetter(str.charAt(1))) return true; else return false; } /*************************************/ /* NAME: is_num_constant */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_num_constant(String str) { int i=1; if ( Character.isDigit(str.charAt(0))) { while ( i <= str.length() && str.charAt(i) != '\0' ) /* until meet token end sign */ { if(Character.isDigit(str.charAt(i+1))) i++; else return false; } /* end WHILE */ return true; } else return false; /* other return FALSE */ } /*************************************/ /* NAME: is_str_constant */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_str_constant(String str) { int i=1; if ( str.charAt(0) =='"') { while (i < str.length() && str.charAt(0)!='\0') /* until meet the token end sign */ { if(str.charAt(i)=='"') return true; /* meet the second '"' */ else i++; } /* end WHILE */ return true; } else return false; /* other return FALSE */ } /*************************************/ /* NAME: is_identifier */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_identifier(String str) { int i=0; if ( Character.isLetter(str.charAt(0)) ) { while(i < str.length() && str.charAt(i) !='\0' ) /* unti meet the end token sign */ { if(Character.isLetter(str.charAt(i)) || Character.isDigit(str.charAt(i))) i++; else return false; } /* end WHILE */ return false; } else return true; } /******************************************/ /* NAME: unget_error */ /* INPUT: a BufferedReader */ /* OUTPUT: print error message */ /******************************************/ static void unget_error(BufferedReader br) { System.out.print("It can not get charcter\n"); } /*************************************************/ /* NAME: print_spec_symbol */ /* INPUT: a spec_symbol token */ /* OUTPUT : print out the spec_symbol token */ /* according to the form required */ /*************************************************/ static void print_spec_symbol(String str) { if (str.equals("{")) { System.out.print("lparen.\n"); return; } if (str.equals(")")) { System.out.print("rparen.\n"); return; } if (str.equals("[")) { System.out.print("lsquare.\n"); return; } if (str.equals("]")) { System.out.print("rsquare.\n"); return; } if (str.equals("'")) { System.out.print("quote.\n"); return; } if (str.equals("`")) { System.out.print("bquote.\n"); return; } } /*************************************/ /* NAME: is_spec_symbol */ /* INPUT: a token */ /* OUTPUT: a BOOLEAN value */ /*************************************/ static boolean is_spec_symbol(char c) { if (c == '(') { return true; } if (c == ')') { return true; } if (c == '[') { return true; } if (c == ']') { return true; } if (c == '/') { return true; } if (c == '`') { return true; } if (c == ',') { return true; } return false; /* others return FALSE */ } public static void main(String[] args) throws IOException { String fname = null; if (args.length == 0) { /* if not given filename,take as '""' */ fname = new String(); } else if (args.length == 1) { fname = args[1]; } else { System.out.print("Error!,please give the token stream\n"); System.exit(0); } Printtokens2 t = new Printtokens2(); BufferedReader br = t.open_token_stream(fname); /* open token stream */ String tok = t.get_token(br); while (tok != null) { /* take one token each time until eof */ t.print_token(tok); tok = t.get_token(br); } System.exit(0); } } 规格说明:Input: Location of a file (input for main() method) that contains yet to be classified content If a location is not given, an empty string is provided for the main() method. An input stream will be created for user to input yet to be classified content in the console Type of classification: Keyword: List of Keywords: and, or, if, xor, lambda, =>. Special Symbol: List of Special Symbols: "(", ")", "[", "]", "’" , "`", ",". (lparen, rparen, lsquare, rsquare, quote, bquote, comma) Identifier: Examples: a, aa, a1, a2, etc. (Identifiers start with a letter, contain only letters and digits) Number Constant: Examples: 123, 1, 321, etc. String Constant: Examples: "asd", "123", etc. (Strings are surrounded by " ", use Escape character) Character Constant: Examples: #a, #b, #c, #d, etc. Comment: Anything starts with ";". Error: Everything else. Output Format: Classification, "original input". or Special Symbol. Example Input: and`and id1 112A ;err #a 123 “123” "123" Output: keyword,"and". bquote. keyword,"and". identifier,"id1". error,"112A". character,"a". numeric,123. error,"“123”". string,"123". 1、用Eclipse建立一个project来编译执行指定测试目标的Java源代码“Printtokens2.java”(即被测代码,可从超链接或作业页面下载)。 2、设计白盒测试用例,达到判定条件覆盖(即必须满足判定+条件覆盖准则)。 3、使用等价类划分、边界值分析方法完成具体的测试用例(即给出具体的输入和预期输出)。 4、根据以上设计的测试用例,编写JUnit测试代码(测试代码必须以文本方式粘贴在报告中)。 5、运行JUnit测试代码进行测试,给出运行结果截图,以及测试用例实际输出与预期输出的比较分析。 6、利用EclEmma(JaCoCo)完成被测代码覆盖分析(Printtokens2.java代码覆盖率应达到90%以上,同时最大可能地满足条件覆盖即减少覆盖率视图下代码被黄色标记的区域),并生成打包HTML格式代码覆盖测试报告(覆盖率截图要放在本报告中,HTML格式的代码覆盖率报告应使用EclEmma自动打包功能后单独上传)。
10-21
【直流微电网】径向直流微电网的状态空间建模与线性化:一种耦合DC-DC变换器状态空间平均模型的方法 (Matlab代码实现)内容概要:本文介绍了径向直流微电网的状态空间建模与线性化方法,重点提出了一种基于耦合DC-DC变换器状态空间平均模型的建模策略。该方法通过对系统中多个相互耦合的DC-DC变换器进行统一建模,构建出整个微电网的集中状态空间模型,并在此基础上实施线性化处理,便于后续的小信号分析与稳定性研究。文中详细阐述了建模过程中的关键步骤,包括电路拓扑分析、状态变量选取、平均化处理以及雅可比矩阵的推导,最终通过Matlab代码实现模型仿真验证,展示了该方法在动态响应分析和控制器设计中的有效性。; 适合人群:具备电力电子、自动控制理论基础,熟悉Matlab/Simulink仿真工具,从事微电网、新能源系统建模与控制研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①掌握直流微电网中多变换器系统的统一建模方法;②理解状态空间平均法在非线性电力电子系统中的应用;③实现系统线性化并用于稳定性分析与控制器设计;④通过Matlab代码复现和扩展模型,服务于科研仿真与教学实践。; 阅读建议:建议读者结合Matlab代码逐步理解建模流程,重点关注状态变量的选择与平均化处理的数学推导,同时可尝试修改系统参数或拓扑结构以加深对模型通用性和适应性的理解。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值