Class: Rouge::Lexers::Stata

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/stata.rb

Constant Summary collapse

KEYWORDS =

Partial list of common programming and estimation commands, as of Stata 16 Note: not all abbreviations are included

%w(
  do run include clear assert set mata log
  by bys bysort cap capt capture char class classutil which cdir confirm new existence creturn
  _datasignature discard di dis disp displ displa display ereturn error _estimates exit file open read write seek close query findfile fvexpand
  gettoken java home heapmax java_heapmax icd9 icd9p icd10 icd10cm icd10pcs initialize javacall levelsof
  tempvar tempname tempfile macro shift uniq dups retokenize clean sizeof posof
  makecns matcproc marksample mark markout markin svymarkout matlist
  accum define dissimilarity eigenvalues get rowjoinbyname rownames score svd symeigen dir list ren rename
  more pause plugin call postfile _predict preserve restore program define drop end python qui quietly noi noisily _return return _rmcoll rmsg _robust
  serset locale_functions locale_ui signestimationsample checkestimationsample sleep syntax sysdir adopath adosize
  tabdisp timer tokenize trace unab unabcmd varabbrev version viewsource
  window fopen fsave manage menu push stopbox
  net from cd link search install sj stb ado update uninstall pwd ssc ls
  using insheet outsheet mkmat svmat sum summ summarize
  graph gr_edit twoway histogram kdensity spikeplot
  mi miss missing var varname order compress append
  gen gene gener genera generat generate egen replace duplicates
  estimates nlcom lincom test testnl predict suest
  _regress reg regr regre regres regress probit logit ivregress logistic svy gmm ivprobit ivtobit
  bsample assert codebook collapse compare contract copy count cross datasignature d ds desc describe destring tostring
  drawnorm edit encode decode erase expand export filefilter fillin format frame frget frlink gsort
  import dbase delimited excel fred haver sas sasxport5 sasxport8 spss infile infix input insobs inspect ipolate isid
  joinby label language labelbook lookfor memory mem merge mkdir mvencode notes obs odbc order outfile
  pctile xtile _pctile putmata range recast recode rename group reshape rm rmdir sample save saveold separate shell snapshot sort split splitsample stack statsby sysuse
  type unicode use varmanage vl webuse xpose zipfile
  number keep tab table tabulate stset stcox tsset xtset
)
PRIMITIVE_FUNCTIONS =

Complete list of functions by name, as of Stata 16

%w(
  abbrev abs acos acosh age age_frac asin asinh atan atan2 atanh autocode
  betaden binomial binomialp binomialtail binormal birthday bofd byteorder
  c _caller cauchy cauchyden cauchytail Cdhms ceil char chi2 chi2den chi2tail Chms
  chop cholesky clip Clock clock clockdiff cloglog Cmdyhms Cofc cofC Cofd cofd coleqnumb
  collatorlocale collatorversion colnfreeparms colnumb colsof comb cond corr cos cosh
  daily date datediff datediff_frac day det dgammapda dgammapdada dgammapdadx dgammapdxdx dhms
  diag diag0cnt digamma dofb dofC dofc dofh dofm dofq dofw dofy dow doy dunnettprob e el epsdouble
  epsfloat exp expm1 exponential exponentialden exponentialtail
  F Fden fileexists fileread filereaderror filewrite float floor fmtwidth frval _frval Ftail
  fammaden gammap gammaptail get hadamard halfyear halfyearly has_eprop hh hhC hms hofd hours
  hypergeometric hypergeometricp
  I ibeta ibetatail igaussian igaussianden igaussiantail indexnot inlist inrange int inv invbinomial invbinomialtail
  invcauchy invcauchytail invchi2 invchi2tail invcloglog invdunnettprob invexponential invexponentialtail invF
  invFtail invgammap invgammaptail invibeta invibetatail invigaussian invigaussiantail invlaplace invlaplacetail
  invlogistic invlogistictail invlogit invnbinomial invnbinomialtail invnchi2 invnchi2tail invnF invnFtail invnibeta invnormal invnt invnttail
  invpoisson invpoissontail invsym invt invttail invtukeyprob invweibull invweibullph invweibullphtail invweibulltail irecode islepyear issymmetric
  J laplace laplaceden laplacetail ln ln1m ln1p lncauchyden lnfactorial lngamma lnigammaden lnigaussianden lniwishartden lnlaplaceden lnmvnormalden
  lnnormal lnnormalden lnnormalden lnnormalden lnwishartden log log10 log1m log1p logistic logisticden logistictail logit
  matmissing matrix matuniform max maxbyte maxdouble maxfloat maxint maxlong mdy mdyhms mi min minbyte mindouble minfloat minint minlong minutes
  missing mm mmC mod mofd month monthly mreldif msofhours msofminutes msofseconds
  nbetaden nbinomial nbinomialp nbinomialtail nchi2 nchi2den nchi2tail nextbirthday nextleapyear nF nFden nFtail nibeta
  normal normalden npnchi2 npnF npnt nt ntden nttail nullmat
  plural poisson poissonp poissontail previousbirthday previousleapyear qofd quarter quarterly r rbeta rbinomial rcauchy rchi2 recode
  real regexm regexr regexs reldif replay return rexponential rgamma rhypergeometric rigaussian rlaplace rlogistic rnormal
  round roweqnumb rownfreeparms rownumb rowsof rpoisson rt runiform runiformint rweibull rweibullph
  s scalar seconds sign sin sinh smallestdouble soundex soundex_nara sqrt ss ssC strcat strdup string stritrim strlen strlower
  strltrim strmatch strofreal strpos strproper strreverse strrpos strrtrim strtoname strtrim strupper subinstr subinword substr sum sweep
  t tan tanh tC tc td tden th tin tm tobytes tq trace trigamma trunc ttail tukeyprob tw twithin
  uchar udstrlen udsubstr uisdigit uisletter uniform ustrcompare ustrcompareex ustrfix ustrfrom ustrinvalidcnt ustrleft ustrlen ustrlower
  ustrltrim ustrnormalize ustrpos ustrregexm ustrregexra ustrregexrf ustrregexs ustrreverse ustrright ustrrpos ustrrtrim ustrsortkey
  ustrsortkeyex ustrtitle ustrto ustrtohex ustrtoname ustrtrim ustrunescape ustrupper ustrword ustrwordcount usubinstr usubstr
  vec vecdiag week weekly weibull weibullden weibullph weibullphden weibullphtail weibulltail wofd word wordbreaklocale wordcount
  year yearly yh ym yofd yq yw
)

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, #continue_lex, continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.reserved_keywordsObject

Stata commands used with braces. Includes all valid abbreviations for ‘forvalues’.



90
91
92
# File 'lib/rouge/lexers/stata.rb', line 90

def self.reserved_keywords
  @reserved_keywords ||= Set.new %w(if else foreach forv forva forval forvalu forvalue forvalues to while in of continue break nobreak)
end

.type_keywordsObject

Note: types ‘str1-str2045` handled separately below



85
86
87
# File 'lib/rouge/lexers/stata.rb', line 85

def self.type_keywords
  @type_keywords ||= Set.new %w(byte int long float double str strL numeric string integer scalar matrix local global numlist varlist newlist)
end